fizban2 Posted September 29, 2006 Share Posted September 29, 2006 Hey guys,trying to figure out why this script won't go through Dim objWMI : Set objWMI = GetObject("winmgmts:")Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from Win32_ComputerSystem")Dim objComputer, strModelFor Each objComputer in colSettingsIf objComputer.Model = "OptiPlex GX270" thenwscript.echo "test"end ifstrModel = objComputer.ModelNextwscript.echo "Computer Model: " & strModelshoudl just return the computer model and then have different actions based on what model it isi tried a select case statement with no luck, it doesn't want to pickup the objComputer.Model value in the IF statement Link to comment Share on other sites More sharing options...
gunsmokingman Posted September 29, 2006 Share Posted September 29, 2006 Try the script this way first to see what comes back this will give you what the correct needed for the bottom script.Dim objWMI : Set objWMI = GetObject("winmgmts:") Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from Win32_ComputerSystem") Dim objComputer, strModel For Each objComputer in colSettings wscript.echo objComputer.Model NextThen try the scrip this way with the correct string I left what the string that was return on my computer from the top script this script below did return the strModel varibleDim objWMI : Set objWMI = GetObject("winmgmts:") Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from Win32_ComputerSystem") Dim objComputer, strModel For Each objComputer in colSettings If objComputer.Model = "L7VMM3" then strModel = objComputer.Model end if Next wscript.echo "Computer Model: " & strModel Link to comment Share on other sites More sharing options...
fizban2 Posted September 29, 2006 Author Share Posted September 29, 2006 Dim objWMI : Set objWMI = GetObject("winmgmts:")Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from Win32_ComputerSystem")Dim objComputer, strModel For Each objComputer in colSettings wscript.echo objComputer.Model If objComputer.Model = "OptiPlex GX270" then strModel = objComputer.Model end if Next wscript.echo "Computer Model: " & strModelthis is what i am working with, the value comes bac as "OptiPlex GX270" but when i use that vaule it fails, it is driving me insane, this should have been pretty simple. Link to comment Share on other sites More sharing options...
gunsmokingman Posted September 29, 2006 Share Posted September 29, 2006 Try this script I change the querry to look for the manufactureDim objWMI : Set objWMI = GetObject("winmgmts:") Dim colSettingsComp : Set colSettings = objWMI.ExecQuery("Select * from Win32_ComputerSystem") Dim objComputer, strModel For Each objComputer in colSettings If objComputer.Manufacturer = "ECS" Then strModel = "Computer MotherBoard : " & objComputer.Model & vbCrLf &_ "Computer Manufacturer : " & objComputer.Manufacturer end if Next wscript.echo strModel Link to comment Share on other sites More sharing options...
fizban2 Posted September 29, 2006 Author Share Posted September 29, 2006 working nowthanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now