Hello all,
I am REALLY GREEN to VBscripting. I've been working on this script for the last couple of days but cannot seem to get past being able to get the script to evaluate the information from the registry. Here is my script:
Dim intRegValue, RegValue, InputFile, ComputeVal
const HKLM = &H80000002
Set oShell = WScript.CreateObject("WSCript.shell")
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!" & strComputer & "\root\default:StdRegProv")
Set objFileToWrite = CreateObject("Scripting.FileSystemObject").OpenTextFile("C:\Tmp8\Version.txt",2,true)
strComputer = "."
strKeyPath = "Software\Altiris\Altiris Agent"
strValueName = "Version"
intRegValue = objWMI.GetStringValue(HKLM,strKeyPath,strValueName,strValue)
Set FSO = CreateObject("Scripting.FileSystemObject")
InputFile = "C:\Tmp8\Version.txt"
Set oFile = FSO.OpenTextFile(InputFile)
objFileToWrite.WriteLine(strValue)
objFileToWrite.Close
Set objFileToWrite = Nothing
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
RegValue = oFile.ReadLine
ComputeVal = Cint(RegValue)
if ComputeVal > 7.1 Then
msgbox "Altiris Agent Version is v7.1."
else
msgbox "Your Altiris Agent is less than v7.1"
oShell.run("cmd /k C:\Tmp\Test.bat")
end if
I've tried evaluating it right in the script but that didn't work. I tried evaluating it from a text file but that didn't work either. In every case I either get a "Type mismatch: Cint" 800A000D or I get a "Type mismatch: '[string:" 800A000D. Any help you someone can provide would be greatly appreciated. Thanks
I am REALLY GREEN to VBscripting. I've been working on this script for the last couple of days but cannot seem to get past being able to get the script to evaluate the information from the registry. Here is my script:
Dim intRegValue, RegValue, InputFile, ComputeVal
const HKLM = &H80000002
Set oShell = WScript.CreateObject("WSCript.shell")
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!" & strComputer & "\root\default:StdRegProv")
Set objFileToWrite = CreateObject("Scripting.FileSystemObject").OpenTextFile("C:\Tmp8\Version.txt",2,true)
strComputer = "."
strKeyPath = "Software\Altiris\Altiris Agent"
strValueName = "Version"
intRegValue = objWMI.GetStringValue(HKLM,strKeyPath,strValueName,strValue)
Set FSO = CreateObject("Scripting.FileSystemObject")
InputFile = "C:\Tmp8\Version.txt"
Set oFile = FSO.OpenTextFile(InputFile)
objFileToWrite.WriteLine(strValue)
objFileToWrite.Close
Set objFileToWrite = Nothing
Set objWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
RegValue = oFile.ReadLine
ComputeVal = Cint(RegValue)
if ComputeVal > 7.1 Then
msgbox "Altiris Agent Version is v7.1."
else
msgbox "Your Altiris Agent is less than v7.1"
oShell.run("cmd /k C:\Tmp\Test.bat")
end if
I've tried evaluating it right in the script but that didn't work. I tried evaluating it from a text file but that didn't work either. In every case I either get a "Type mismatch: Cint" 800A000D or I get a "Type mismatch: '[string:" 800A000D. Any help you someone can provide would be greatly appreciated. Thanks