Create directory if it does not exist
I am writing a PowerShell script to create several directories if they do not exist. The filesystem looks similar to this D:\ D:\TopDirec\SubDirec\Project1\Revision1\Reports\ … Read more
I am writing a PowerShell script to create several directories if they do not exist. The filesystem looks similar to this D:\ D:\TopDirec\SubDirec\Project1\Revision1\Reports\ … Read more
I’ve been looking for a way to terminate a PowerShell (PS1) script when an unrecoverable error occurs within a function. For example: function … Read more
If I have a function which accepts more than one string parameter, the first parameter seems to get all the data assigned to … Read more
There’s a PowerShell script named itunesForward.ps1 that makes iTunes fast forward 30 seconds: $iTunes = New-Object -ComObject iTunes.Application if ($iTunes.playerstate -eq 1) { … Read more
What is the “best” way to handle command-line arguments? It seems like there are several answers on what the “best” way is and … Read more
Is it possible to split a PowerShell command line over multiple lines? In Visual Basic I can use the underscore (_) to continue … Read more
Whenever I need to reference a common module or script, I like to use paths relative to the current script file. That way, … Read more
Suppose I have the following snippet: $assoc = New-Object PSObject -Property @{ Id = 42 Name = “Slim Shady” Owner = “Eminem” } … Read more
How do you comment out code in PowerShell (1.0 or 2.0)? 10 s 10 In PowerShell V1 there’s only # to make the … Read more
I am trying to run a cmd file that calls a PowerShell script from cmd.exe, but I am getting this error: Management_Install.ps1 cannot … Read more