Skip to main content

Questions tagged [powershell-v4.0]

1 vote
1 answer
923 views

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
870 views

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
326 views

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,343
-1 votes
1 answer
8k views

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
911 views

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
655 views

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
700 views

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
424 views

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
616 views

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

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
299 views

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
2k views

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
909 views

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
4 votes
3 answers
22k views

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

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 -NoNewWindow -...
Sankar's user avatar
  • 279
2 votes
1 answer
506 views

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
  • 54.3k
3 votes
2 answers
17k views

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

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
7 votes
1 answer
16k views

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
  • 225
1 vote
1 answer
2k views

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
148 views

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
82 views

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

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,457
3 votes
1 answer
3k views

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
  • 143
1 vote
1 answer
5k views

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
3k views

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

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
802 views

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
  • 349
0 votes
1 answer
105 views

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,654
2 votes
1 answer
1k views

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,654
0 votes
1 answer
2k views

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
1k views

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
12k views

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
  • 54.3k
3 votes
1 answer
908 views

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,728
3 votes
1 answer
4k views

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

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
445 views

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

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
  • 803
0 votes
1 answer
228 views

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
179 views

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
3k views

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
  • 666
3 votes
1 answer
8k views

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
4 votes
3 answers
12k views

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
21k views

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

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

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,457
4 votes
1 answer
2k views

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
3k views

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
  • 4,071
11 votes
2 answers
164k views

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

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
  • 1,019