Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Widows 7 script

Status
Not open for further replies.

deltsigjoe

IS-IT--Management
Apr 12, 2011
16
US
can some one point me in the right direction for a script to execute under Windows 7 32bit only.

I have not been able to find both.
Please help.
 
I have seemed to have found the following just as a test, but they both run and give the same XP message... any suggestions??

' -------------------------------------------------------------------------
' Test to check OS version
' -------------------------------------------------------------------------

Option Explicit
On Error Resume Next



' *********************************************************************************
' Separates different versions
' *********************************************************************************

CONST HKEY_LOCAL_MACHINE = &H80000002
CONST WINDOWS_XP = "Microsoft Windows XP"

strComputer = "."
set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
objReg.GetStringValue HKEY_LOCAL_MACHINE, "SOFTWARE\Microsoft\Windows NT\CurrentVersion", "ProductName", strComputerOS

if (strComputerOS = WINDOWS_XP) then
'Run the XP version
wscript.echo "Windows XP"



else
'Run the Win7 version
wscript.echo "Windows 7"

end if

' *********************************************************************************
' End Separates different versions
' *********************************************************************************
 
what's your OS? Also, open [tt]regedit[/tt] and traverse to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion. What's the value of ProductName? Furthermore, remove [tt]On Error Resume Next[/tt] from the script to see if there are any hidden errors.

-Geates

"I hope I can chill and see the change - stop the bleed inside and feel again. Cut the chain of lies you've been feeding my veins; I've got nothing to say to you!"
-Infected Mushroom

"I do not offer answers, only considerations."
- Geates's Disclaimer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top