SETUP/INSTALLATION

1 – install powershell 2.0/windows management framework on local machine and remote servers that you want to manage.
http://support.microsoft.com/kb/968929
– running scripts on a remote machine only works in powershell 2.0 — both the local and the remote server have to be using powershell 2.0.
– for windows 7 or win 2003/2008, if powershell 1.0 is already installed, uninstall it first before installing powershell 2.0

2 – create C:scripts folder to save all your scripts locally and on each remote server.

3 – The Set-Location cmdlet is roughly equivalent to the cd command found in Cmd.exe: it enables you to specify a new working location in a namespace. For example, this command sets the working location to C:Scripts:
Set-Location c:scripts

4 – type the following in powershell prompt to see Windows Path —
$a = $env:path; $a.Split(“;”)
c:scripts will not be there.

5 – now you need to add c:scripts to your Windows Path by typing:
$env:path = $env:path + “;c:scripts”

6 – if you rerun command from step #4, you will see the new c:scripts path appear.

7 – to enable execution of powershell commands/scripts on remote server, run the following from a powershell prompt on remote server:
winrm quickconfig
then
set-executionpolicy unrestricted

8 – In general, you need to type the complete file path in order to run a script. For example, c:scriptstest1 (no need to type .ps1)
– if you are already in the directory where the script resides, you can type:
.test