PowerShell is an incredible tool that will allow you to run scripts or commands on your server. PowerShell is included with Windows Server 2008 R2 but it has to be added to Windows Server 2003. I recently had a customer who got their server (DC) infected with a virus and it was a huge problem to do anything to the box because when they logged in (with any user) the virus kicked in and prevented them from running anything. Remote Management was NOT enabled on the server so they were in big trouble. If they had PowerShell installed this monumental problem would have been nothing but an annoyance. So, take a bit of advice and install PowerShell on all your servers, just in case you ever need the power of PowerShell on your server you will have it available. You must be on Windows Server 2002 Service Pack 2 (SP2) in order to use PowerShell v2.
First you need to download and install “Windows Management Framework” (Which gives you Windows PowerShell 2.0, WinRM 2.0, and BITS 4.0) Details on this package as well as the download links can be found here http://support.microsoft.com/kb/968929
In this customers case they would have downloaded
Download the Windows Management Framework Core for Windows Server 2003 package now. (http://www.microsoft.com/downloads/details.aspx?FamilyId=f002462b-c8f2-417a-92a3-287f5f81407e)
Or if they had a 64bit OS …
Download the Windows Management Framework Core for Windows Server 2003 x64 Edition package now.
This will install as an OS Hotfix. When I did it on my 2003 server, it did not create an icon for the PowerShell.exe program.
I simply clicked Start-Run typed in powershell <ENTER> and PowerShell launched. When I ran it the first time, PowerShell was automatically added to my freqently used programs but if you are not so lucky, you can manually create an icon for it. The Powershell Executable is located at c:\windows\system32\WindowsPowerShell\v1.0\PowerShell.exe
You will want to make sure that remote management and WMI is enabled on the server.
Start – Run – services.msc <ENTER>
Scroll down and find: Windows Management Instrumentation and Windows Remote Management (WS-Management) and make sure they are both started and set to run automatically.
Now, we need to enable remote sessions:
Open PowerShell on the Windows 2003 Server and run the command Enable-psRemoting.
Open PowerShell Window
Now you should be able to go to a different computer that has powershell enabled and test connecting to the 2003 machine. I my case I am connecting to the 2003 machine from a Windows 2008 R2 machine. From a 2008 R2 machine, open a PowerShell Windows and type in
If you have not enabled-psRemoting on the 2008 R2 box go ahead and do that while you are there. Let’s try the following from the 2008 machine to connect and remotely manage the 2003 machine
Open PowerShell windows and type…
Enter-psSession MachineName <ENTER>
Any commands you want to run will now run on the remote machine see screenshot
to end your remote session type
If you like this post, please contact me on Twitter @ITProGuru to let me know. To keep from missing other posts, make sure you add an RSS to my blog.
Thanks for the article, it was very helpful for me. Unfortunately I'm holding back on installing powershell on a 2k3r2 production box due to it being a service monitor server. I need to figure out a way to install with no restart or schedule a maintenance just to install powershell. :(
"You must be on Windows Server 2002" - what version?