Might be worth trying to do this in Powershell. That way you get the script you want, but with the .Net framework access that may get you what you need. Powershell 1.0 was shipped in Vista, and 2.0 with Windows 7. It can also be manually installed on XP.