Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Create VB script to compare variable and then if not equal to x then compute

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

 

 
  
  Printable Version
All Forums >> [Scripting] >> WSH & Client Side VBScript >> Create VB script to compare variable and then if not equal to x then compute
  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 >>
 Create VB script to compare variable and then if not eq... - 7/9/2008 2:21:38 AM   
  jointheir

 

Posts: 1
Score: 0
Joined: 7/9/2008
Status: offline
    Lookiing to create a script that can check for a variable, if not avail or null set it, if less than xx then compute based on old value + new value.
Here is what I got so far:
Set WshNetwork = WScript.CreateObject("WScript.Network")
Set sh = WScript.CreateObject("WScript.Shell")

GVP_STATUS = sh.ExpandEnvironmentStrings("%GVP_STATUS%")

if (GVP_STATUS = "") then
' ------ SCRIPT CONFIGURATION ------
strVarName = "GVP_STATUS"
strVarValue = "4"
strComputer = "."
' ------ END CONFIGURATION ---------
set objVarClass = GetObject("winmgmts:\\" & strComputer & _
                           "\root\cimv2:Win32_Environment")
set objVar = objVarClass.SpawnInstance_
objVar.Name = strVarName
objVar.VariableValue = strVarValue
objVar.UserName = "<SYSTEM>"
objVar.Put_
WScript.Echo "Created environment variable " & strVarName

What happens is I am trying to monitor servers down. Each server has a value and together they will all equal 22 so the ONLY way it can reach 22 is if all have come in and been computed. the values are 4, 5, 6, 7
So when server 4 goes down if it is the first then set the variable to 4 Which I got that.. But it needs to check before it gets there to see if the value >1 then compute, otherwise set it becuase it has been the first one down.
Where I cant get it is the math and the compare..
thanks
 
 
Post #: 1
 
 
 
  

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 >> Create VB script to compare variable and then if not equal to x then compute 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