People who code: we want your input. Take the Survey

Questions tagged [powershell-v4.0]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0
votes
0answers
34 views

Why Get-SmbOpenFile returns unexpected results?

Get-SmbOpenFile really behaves unexpectedly. Even the .vhdxfile is mounted and can be seen from diskmgmt.msc but when I issue the command Get-SmbOpenFile, time to time the mounted file doesn't shows ...
1
vote
1answer
139 views

Why Get-SmbOpenFile losses the lock when file still opened at remote

I am using Get-SmbOpenFile, But surprisingly, it looses its connection and I can see that there is no lock even after couple of seconds later on the file any more, even it is still opened. I safely ...
1
vote
1answer
36 views

I want to delete 30 days old folder + sub folder by using Powershell were folder save in date wise

I want to delete 30 days old folder & all sub folder which name start "dba_20200312-0500311 - 123" # $curDateTime = Get-Date -Format yyyyMMdd-HHmmss, folder save in this date format $mydays = (...
0
votes
1answer
58 views

WIn 2012/R2 How to find Powershell ISE 32 bit

First, I don't see any matches for "ISE" when I click the start button and type "ISE". I am able to run C:\Windows\System32\WindowsPowerShell\v1.0\powershell_ise.exe and open ISE it seems to be the ...
-1
votes
1answer
3k views

A parameter cannot be found that matches parameter name -ComputerName

I written a script to verify the services were succefully stopped If not it will kill the running processes. Below is my script. Let me know what needs be added. I am very new to powershell. $...
0
votes
1answer
298 views

How to get the size of the file using get-itemproperty in PowerShell?

I have a file having data around 5GB. I tried to get size of the file using get-content $path2 | Measure-Object method. But its taking more time as Get-Content cmdlet is present. Is there method to ...
0
votes
0answers
320 views

Illegal Characters in Path While Installing Module

In Powershell 4, I'm attempting to install the GoogleCloud module. I use the command: Install-Module GoogleCloud It fails with: PackageManagement\Install-Package : Illegal characters in path. At C:...
0
votes
2answers
391 views

How to filter the content of Powershell script output?

I need to capture the result of MSSQL Queries in Ansible output however, there are no supported Ansible modules which help me to achieve this. As a workaround, i have written a powershell script which ...
1
vote
0answers
126 views

How do I use Power Shell to copy folders from local to remote Linux Server

I am trying to make a script that will let me update the files on the server by copying then from local. I made a bash script for this task that works on Linux, but a Power Shell script is also needed ...
1
vote
1answer
305 views

Powershell Array for Path

We are trying to break the following Path from the text file, the path is dynamic in length, i.e, it can be ABC\DSD\AAR\ARE or ABC\DSD. So we need a solution to break down the path as per the ...
1
vote
1answer
919 views

Manual PowerShell DSC module installation

I am working on servers without access to the Internet. I am uploading DSC modules to the server, E.g. AccessControlDSC. The modules are being installed in c:\Program Files\WindowsPowerShell\Modules ...
0
votes
1answer
105 views

PS-Remote shell access to a user

I am currently adding Full control to an user manually. Please see below screen shot. But this needs to be done via a PS script.I followed https://blogs.technet.microsoft.com/heyscriptingguy/2010/11/...
-1
votes
2answers
966 views

Powershell script Needd to set the state of Allow Remote Shell Access [closed]

I am looking for a script which will set the value to "Enable/Not Configured/Disable" of Allow Remote Shell Access in Gpedit via Powershell script. Below value state value should get changed to ...
0
votes
1answer
617 views

Adding the Exchange 2013 PS SnapIn using Invoke-Command not working

I've been building a Powershell Module for our helpdesk team, and ran into an issue at some point: They don't seem to have the proper access rights to add the Exchange 2013 Powershell SnapIn, and I ...
2
votes
2answers
6k views

Remote Powershell not working but test-wsman does

I need to script some routine task to execute remotly from a serverA to many hosts but a couple of them fail to execute the script. If i execute this: $cred = Get-Credential myUser Invoke-Command -...
1
vote
1answer
2k views

How to execute “-NoNewWindow” parameter in powershell v4

I have used following command for my automation task. But it is throwing exception like below, parameter set cannot be resolved Command I used: Start-Process -FilePath powershell.exe -...
2
votes
1answer
263 views

Truncating part of an LDAP DN in Powershell? (Or getting the OU from an LDAP DN.)

What's the easiest way to get the OU containing an LDAP object in PowerShell? I'm working on a script to manage some groups that I've made "dynamic" with a script, and I can get the full ...
3
votes
2answers
11k views

Howto check if a powershell command succeeded or not?

Is it possible to check if a powershell command succeeded or not? Example: Set-CASMailbox -Identity:blocks.5 -OWAMailboxPolicy "DoNotExists" caused the error: Outlook Web App mailbox policy "...
0
votes
1answer
640 views

Get-AD GroupMember from a list of users in a csv

I have a list of users in a csv file, they are the displaynames. I wrote the following but all I get back is the displayname not the memberships what is needed? $csv = Import-CSV "c:\users.csv" ...
4
votes
1answer
10k views

How to access/obtain Powershell DNS Server module on 2012r2?

I'm working on a Server 2012R2 server. I want to use the comdlets like get-dnsserverresourcerecord in the dns server module for PowerShell. It is not available in the ISE or in the list of modules. ...
1
vote
1answer
1k views

how to create Automatic install user based certificate from ADCS with script

We have a certificate server from which users are able to download their certificate (User Template) from this URL: http://localhost/certsrv. I now want to create a script which will do the ...
0
votes
1answer
100 views

PowerShell Sciprt to Logon a User to Win 2008 R2 Server?

I am a PowerShell Noob so please forgive. I have a Windows ID on a Win 2008 R2 server that runs a dedicated Outlook VBA application. I have tried suggestions on how to get this userid to autologon ...
1
vote
0answers
53 views

Why is HyperV Checkpoint-VM parameter SnapshotName ignored when Powershell remoting?

Having this code in powershell: $Servers = "computer.domain.com" # Open Session $Session = New-PSSession -ComputerName $Servers # Create Daily Checkpoints. Invoke-Command -Session $Session -...
6
votes
2answers
730 views

Query Powershell Error Object Time Occured

Powershell error objects contain a lot of data but I can't seem to track down the time of occurrence for a given error. Using $Error[0] | fl -f retrieves a lot of information but none that appears to ...
2
votes
1answer
1k views

WinRM service is running but will not respond

I have an environment with 16 vms on a host. They all run Windows2008R2. At one point I had powershell remoting work on all servers but one. Then I lost contact with two more. This is annoying, to say ...
1
vote
1answer
3k views

Passing list input to Get-ADComputer

SO I wrote a script that gets some information from AD about a user and their associated computer(s). I have read online about a few of the problems people face with the Get-ADComputer cmdlet and ...
0
votes
0answers
2k views

Odd behavior using WinRM via powershell, works sometimes and other times does not

Been setting up Powershell Remoting for all of our client machines (Pushed out GPO last week) and I can Test-WSMan on pretty much all of them and I get a nice expected response. Now on one of our ...
0
votes
1answer
2k views

can't open new powershell session from one server to another

I am trying to open a powershell session from one server to another. I can open sessions to servert1/2 which have the same configuration as far as I can tell. trustedhosts are the same, same user/pw ...
1
vote
1answer
636 views

Allow user to add Snap-In in Powershell on Windows Server 2012 RC2

I have a user that is used to run Powershell scripts, triggered by the Windows task scheduler on a Windows 2012RC2 server. The scripts use specific Snap-ins, which are added at the start of the script....
0
votes
1answer
84 views

Powershell: a simple script to take a list of commands and append the same cmdlet every time [closed]

I have a list of commands I run in a script like this Some-Cmdlet -someswitch | Outfile -filepath .\somefile.txt -append Another-Cmdlet -someswitch | Out-File -filepath .\somefile.txt -append Hello-...
2
votes
1answer
1k views

powershell: how to print command to file?

I'm currently using the Out-File cmdlet, like so: PS> Some-Cmdlet -someswitch | Out-File -filepath .\somefile.txt It works great. Is there anyway that I can actually get the command line itself ...
0
votes
1answer
2k views

Powershell scripts to determine remote CPU Temperature [closed]

Is there a Powershell Script to remotely check the CPU temperature of a Domain PC. Thanks
0
votes
1answer
580 views

PowerCLI transfers a file but the copied file size is way too small. What is wrong?

I am using PowerCLI version 6 on a Windows server with 20 GB of free space. I am trying to use copy-datastoreitem with PowerCLI. It seems to work to transfer a .vmdk file from an ESXi datastore to ...
12
votes
4answers
6k views

How can I use PowerShell to enable NTFS compression, in place, on log files older than x days?

I have an application server, running Windows 2012 R2, which generates a high volume of log files, to the point that it runs the application volume out of free space on a semi-regular basis. Due to ...
3
votes
0answers
671 views

Why does Get-Winevent in parallel workflow wants to use PSRemoting?

I'm building a wrapper script for Get-Winevent to search multiple computers' event logs in parallel, using multiple search criteria. I'm contructing a XML filter for Get-Winevent, then call this ...
3
votes
1answer
2k views

Delete only files leaving empty sub-folders using powershell

C:\Temp\ifc has about 297 folders inside it with roughly 4.1 million files spread amongst them. Using a script I found elsewhere on this site, I wrote the following to delete all 'files' which are ...
2
votes
2answers
6k views

Powershell: Save CSV result to folder

This should be absuredly easy but I keep running into a brick wall. I am running a Powershell script which performs an audit of my tasks and saves the result to a CSV. I keep getting a permissions ...
1
vote
0answers
298 views

Why does svn look for cached credentials in the wrong place when run as a scheduled task?

I run a daily Powershell script via Windows Scheduler under a service account that updates a local svn working copy and commits changes. The svn client is sliksvn and is run by command line only. When ...
2
votes
0answers
2k views

Is there a way for me to safely install PowerShell 4 on SBS 2011?

I want PS4 on SBS2011 A requirement of a software our office uses is PowerShell 4. The server is Windows Small Business Server 2011. But PS4 and SBS2011 seem incompatible According to the TechNet ...
0
votes
1answer
167 views

Difference between two powershell scripts

I received a script that is supposed to scan the event logs of 4 DCs, searching the event ID 4740 (user lockout). This is script number 1. Now I thought to myself, "Why scan all the DCs when I can ...
1
vote
0answers
87 views

Repeatedly prompted to restart the computer when installing SQL Server 2008 R2 on a x64 Win 8.1 machine

I am trying to install SQL Server 2008 R2 on a Win 8.1 x64 bit machine. When running the installer, I get the Reboot Required check failing the install. I have tried rebooting, no difference. I ...
2
votes
1answer
2k views

Error denying permissions on GPO with Powershell

I was trying to find a way to set "Apply policy" to "Deny" for a certain group in several GPOs (about 50), so I was looking for a way to do it automatically, when I came across this post at an (...
3
votes
1answer
7k views

Get Computer Object Properties for the list of servers in a file

When I run Get-ADComputer cmdlet, I can view all of the single object's properties, like below. C:\PS>Get-ADComputer "Fabrikam-SRV1" -Properties * AccountExpirationDate : ...
3
votes
3answers
9k views

Powershell, have function return variable that stores it?

Is it possible to have a function return the name of the variable that stores it? i.e $a = myFunction and have the function know that it is held in $a, when $a is dynamically assigned to it in a ...
3
votes
1answer
15k views

Get AD Group Member - Different Domains

I've been tasked with exporting the members of a few AD groups to .csv which I've always done in the past using the Get-ADGroupMember command in powershell, specifying the group name, selecting the ...
1
vote
1answer
1k views

How to receive email notification of non-AD joined DHCP leases?

This answer to theCleaner's question helped me some Windows DHCP Server - get notification when a non-AD joined device gets an IP address but the answer to his question involved Quest Poweshell ...
3
votes
2answers
5k views

How to cast as ArrayList, preset data in param block, and return as ArrayList?

As I need to be able to add and remove items from an array I need to cast it as an ArrayList as opposed to the more common options ([string[]], [Array], $Var=@()). I also need to preset it with data, ...
3
votes
1answer
893 views

new-WindowsImage stalls with 0x8007007E, can't load unattend.dll

I'm trying to convert capture a .VHDX as a .WIM file. The file in question is a syspreped Windows 7 generalized image. - I'm working on Windows 8.1 and I have the Windows ADK installed. - In ...
2
votes
1answer
2k views

How do I troubleshoot “Failed to get staged packages for package” error when attempting to remove a provisioned app from an offline Windows 8.1 image?

When I attempt to remove provisioned apps from an offline Windows 8.1 image, most of the apps I want to remove cause no problem, but attempting to remove Microsoft.Office.OneNote causes an error. The ...
10
votes
2answers
86k views

Powershell: A parameter cannot be found that matches

I am new to the Powershell world. Below is my first script $sServer = "Fully.Qualified.Computer.Name" $os = Get-WmiObject -class Win32_OperatingSystem -computername $sServer $object = New-Object –...