Excluding Windows 7 from Startup Scripts

Windows 7/Server 2008 comes with a host of new GPO settings that fill in the gaps that were left with Server 2003. Things like mapped drives, desktop shortcuts, and many of the other tasks that we used to handle with VBScripts are no longer necessary with Windows 7 and Server 2008.

You may find the need to exclude specific version of windows from startup scripts. Insert the following to the top of your VB script to exclude Windows 7

strComputer = "."
 Set objWMIService = GetObject("winmgmts:\" & strComputer & "rootcimv2")

Set colOperatingSystems = objWMIService.ExecQuery _
 ("Select * from Win32_OperatingSystem")

 For Each objOperatingSystem in colOperatingSystems

 msg = objOperatingSystem.Caption & " " & _
if instr(msg, "Microsoft Windows 7") > 0 then

end if

This can also be used to quickly exclude any version of windows from XP to 2000 if necessary.