Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Newbie Help (Basic decision making in script)

 
Logged in as: Guest
arrSession:exec spGetSession 2,2,62583
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Newbie Help (Basic decision making in script)
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Newbie Help (Basic decision making in script) - 7/21/2008 11:27:55 PM   
  Eisenhorne

 

Posts: 1
Score: 0
Joined: 7/21/2008
Status: offline
Original message moved by dm_4ever
Reason : Moving to Appropriate Forum
Hi everyone, I am very new to scripting but its now a job requirement.    I know the basics but need a little help.    I am using Primalscript as my editor.    I copy and paste most of the scripts from the help documents then edit as needed.  

Here is what I need to do.   

1.    Detect the model of a computer
2.    If the model matches a specific model then run an installation

Here is the script I am using to pick up the model number and it works just right:

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
   & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSettings = objWMIService.ExecQuery _
   ("Select * from Win32_ComputerSystem")
For Each objComputer In colSettings
   WScript.Echo "System Model: " & objComputer.Model
Next

Here is my output:

System Model: OptiPlex 745                
Exit code: 0 , 0000h

So it is working fine but now I need to add some logic to tell it "If the computer is an OptiPlex 745 then run a program.    Also, the Exit code has me confused.

Thanks for the help!
 
 
Post #: 1
 
 RE: Newbie Help (Basic decision making in script) - 7/22/2008 2:49:07 AM   
  twilliamsen

 

Posts: 195
Score: 0
Joined: 1/18/2007
Status: offline
Exit code 0 means that it was successful.

I am running something similar with BIOS updates

Do you have several models? 

Here is some snippet of code I have been running to detect the model, it isn't completed, it is still in the testing phase, but it will give you an idea what to do:


      

The gx270 is a sub to detect the BIOS version and if it matches, then it won't install

Here is the sub, note: it is NOT completed yet.


      

(in reply to Eisenhorne)
 
 
Post #: 2
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Newbie Help (Basic decision making in script) Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts