Today I decided to start diving in to the PowerShell world and discovered some things that might prove to be helpful for someone starting out.
All of the commands that I’ve tried out have been performed on the actual server (Server 2008 x64) and not remotely using the RSAT.
For security, the operating system won’t run non Microsoft PowerShell scripts by default. You need to adjust the ExecutionPolicy to allow PowerShell scripts to run. The better method is to issue this instruction at the PowerShell command line: “set-ExecutionPolicy RemoteSigned”. Alternatively you could edit the registry.
To make the change using the registry, navigate to HKLM\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShell
Then change this registry key REG_SZ ExecutionPolicy RemoteSigned
Once this is complete, you should be able to start writing your own PowerShell scripts and saving them with the *.ps1 extension. You can use Notepad or any other text editor to create them. For an example create a new document with this one line in it: “get-Process”.
Then save that document as getprocess.ps1 to the root of the server you’re working on. In a new PowerShell window, type the full path to the script. Example “c:\getprocess”. This should call the script file and run the contents of it in your current window.