View Full Version : Getting OS Version
WetKippers
02-11-2004, 01:32 AM
I am writing a script to remove a users profiles from every machine on the network. The problem i have is finding what OS a machine is as the script is not running locally and the path of a users profile changes depending on the OS.
mattmac24
02-13-2004, 03:56 AM
when youve got that working could u post link or send to mattishstuff@hotmail.com because i think that would save me a fair amount of time. there is no rush just if or wen u finish it. thanks alot
Nailz
02-26-2004, 07:46 AM
It's been a while since I've posted here, but I knew I've seen this before....
Here's the quick & dirty version.
'----------------start here---------------
Set WshShell = WScript.CreateObject("WScript.Shell")
Set WshSysEnv = WshShell.Environment("SYSTEM")
strOS = WshSysEnv("OS")
strVersionNumber = WshShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\CurrentVersion")
strBuildNumber = WshShell.RegRead("HKLM\Software\Microsoft\Windows NT\CurrentVersion\CurrentBuildNumber")
strActualOS = strOS & ", " & strVersionNumber & ", " & strBuildNumber
Wscript.Echo strActualOS
'----------------end here----------------------------
I would suggest testing and extracting the correct version depending on platform.
I was able to quickly test 3 platforms and got the following results:
Windows XP: Windows_NT, 5.1, 2600
Windows 2000: Windows_NT, 5.0, 2195
Windows NT 4.0: Windows_NT, 4.0, 1381
I'm going to test 2000 Server in the lab later when I get a chance (just out of curiosity). I don't have a Windows 98 or Windows ME machine to test although being that it queries the Windows NT key in the registry, I would assume it would need modification.
I found this at the following MS Technet URL
http://www.microsoft.com/technet/treeview/default.asp?url=/technet/scriptcenter/scrguide/sas_sbp_yarl.asp
"Life isn't like a box of chocolates...it's more like a jar of jalapenos.
What you do today, might burn your butt tomorrow."
Powered by vBulletin™ Version 4.1.0 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.