| |
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
|
|