In response to this post, yes, you actually can "run" PowerShell on Windows 2000. No, there is no out of the box way for it to run. No, it's not supported in the slightest. I'm not even sure it's technically legal (haven't read that Windows EULA in a long time). And even when it is running, there are likely to be things that don't work.
That said, here's how to get Windows PowerShell v1.0 to run on Windows 2000.
What you will need
Creating the installer (on Windows XP)
- Install the .NET Framework 2.0 SDK. You'll need a specific tool from it, and it's easier to just install the SDK and grab the tool than it is to try and extract it somehow.
- Extract KB926139 (run 'WindowsXP-KB926139-v2-x86-ENU.exe /extract').
- Make a copy of the 'powershell.exe' file that was extracted from KB926139. Now break out your hex editor, a copy of the Portable Executable Format Spec, and modify the header so the Windows 2000 loader will actually run the image. Or just use your hex editor to modify the byte beginning at offset 0x00000132 in 'powershell.exe' so it is 0x00 instead of 0x01 (Windows 2000 is version 05.00, not 05.01).
- Read the 'update\update.inf' file extracted from KB926139. This plain text file contains the instructions on how to install PowerShell on Windows XP, so all that's needed is for them to be duplicated on Windows 2000 (batch/reg files? windows scripting host? whatever you want!).
- 'PSCustomSetupUtil.exe /install' doesn't seem to actually work on Windows 2000. So use a combination of 'InstallUtil.exe' from the .NET Framework and 'GacUtil.exe' from the .NET Framework SDK (this tool is the entire reason the .NET Framework SDK is needed).
Installation (on Windows 2000)
- Install the .NET Framework 2.0
- Follow the instructions in update.inf from the extracted KB926139 to install.
- Remember to substitute 'installutil.exe' and 'gacutil.exe' for usages of 'pscustomsetuputil.exe /install'.
- Replace the official version of powershell.exe with the one containing a modified header.
- Maybe create a shortcut and define console window appearance settings.
For the lazy: all scripted up
I've gone ahead and deciphered the update.inf file, so if you're feeling lazy, just download this file and follow these instructions. Note that the included scripts assume that Windows is installed in C:\WINNT. If it's elsewhere, you'll have to modify all the scripts & registry files.
- Unzip the 'install package.zip' file you just downloaded.
- Get 'gacutil.exe' and 'gacutil.exe.config' from the .NET Framework SDK. Place them in the NETFXSDK subdirectory of the unzipped install package.
- Get KB926139 and extract it to the KB926139 subdirectory of the unzipped install package.
- Copy 'powershell.exe' from the KB926139 subdirectory into the bin directory. Modify it as in step 3 of "Creating the installer".
- Take the whole install package structure, now with the PowerShell binaries/installer tools, to a Windows 2000 system and run the 'System Setup.cmd' batch file.
- (optional) Run the 'User Setup.js' script to configure the PowerShell window's default settings to match whatever I had on whatever system I was on when I figured all this out (most useful because it enables tab completion, which isn't on by default in 2k, unlike in XP and later).
Now Playing: Basia Bulat – Oh, My Darling – 07 In the Night