Questions tagged [powershell-v4.0]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1 vote
1 answer
727 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 ...
Usman's user avatar
  • 117
1 vote
1 answer
702 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 = (...
vivek singh's user avatar
0 votes
1 answer
184 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 ...
NealWalters's user avatar
  • 1,333
-1 votes
1 answer
7k 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. $...
Nithin's user avatar
  • 1
0 votes
1 answer
516 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 ...
Dinesh's user avatar
  • 1
0 votes
0 answers
584 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:...
Jason Shindler's user avatar
0 votes
2 answers
598 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 ...
Ankit Vashistha's user avatar
1 vote
0 answers
366 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 ...
Pedro Henrique's user avatar
1 vote
1 answer
549 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 ...
rokr1's user avatar
  • 13
1 vote
1 answer
1k 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 ...
Brettski's user avatar
  • 952
0 votes
1 answer
248 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/...
asur's user avatar
  • 101
-1 votes
2 answers
1k 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 ...
asur's user avatar
  • 101
0 votes
1 answer
810 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 ...
Alex Pilon's user avatar
3 votes
3 answers
18k 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 -...
Nico Osorio's user avatar
1 vote
1 answer
3k 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 -...
Shankar's user avatar
  • 259
2 votes
1 answer
425 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 ...
HopelessN00b's user avatar
  • 53.9k
3 votes
2 answers
16k 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 "...
Sonnenbiene's user avatar
0 votes
1 answer
1k 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" ...
Jedi Administrator's user avatar
6 votes
1 answer
15k 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. ...
Mr.Budris's user avatar
  • 215
1 vote
1 answer
2k 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 ...
saikat chatterjee's user avatar
0 votes
1 answer
124 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 ...
Kenneth Berg's user avatar
1 vote
0 answers
62 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 -...
johnymachine's user avatar
6 votes
2 answers
1k 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 ...
Colyn1337's user avatar
  • 2,417
2 votes
1 answer
2k 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 ...
Albert's user avatar
  • 133
1 vote
1 answer
4k 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 ...
Michael Timmerman's user avatar
0 votes
0 answers
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 ...
TofuBug's user avatar
  • 101
0 votes
1 answer
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 ...
C.Rosenstadt's user avatar
1 vote
1 answer
740 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....
SaAtomic's user avatar
  • 339
0 votes
1 answer
87 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-...
Daniel's user avatar
  • 1,614
2 votes
1 answer
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 ...
Daniel's user avatar
  • 1,614
0 votes
1 answer
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
Bart's user avatar
  • 9
0 votes
1 answer
947 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 ...
Kiran's user avatar
  • 67
15 votes
5 answers
10k 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 ...
HopelessN00b's user avatar
  • 53.9k
3 votes
0 answers
834 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 ...
abstrask's user avatar
  • 1,698
3 votes
1 answer
3k 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 ...
Gareth Doherty's user avatar
2 votes
2 answers
9k 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 ...
Matthew Crews's user avatar
1 vote
0 answers
376 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 ...
josges's user avatar
  • 11
2 votes
0 answers
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 ...
Reece's user avatar
  • 783
0 votes
1 answer
189 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 ...
Eli Bukin's user avatar
1 vote
0 answers
132 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 ...
healthy_meerkat's user avatar
2 votes
1 answer
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 (...
curropar's user avatar
  • 641
3 votes
1 answer
8k 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 : ...
Volodymyr Molodets's user avatar
3 votes
3 answers
11k 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 ...
benignadmin's user avatar
5 votes
1 answer
19k 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 ...
NoobAdmin's user avatar
1 vote
1 answer
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 ...
Art.Vandelay05's user avatar
3 votes
2 answers
6k 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, ...
Colyn1337's user avatar
  • 2,417
4 votes
1 answer
1k 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 powershell I ...
user3062206's user avatar
2 votes
1 answer
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 ...
Jay Michaud's user avatar
  • 3,983
11 votes
2 answers
143k 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 –...
Black Dynamite's user avatar
3 votes
1 answer
9k views

PowerShell - Set default proxy configuration for all PS CmdLets

I can get and set proxy settings for a WebClient object and make outbound calls. I can also supply -Proxy and -ProxyCredential to individual CmdLets, but how can I just set a global default so ...
Luke Puplett's user avatar