SausageSie
Technical User
Basically I am installing VNC using GP startup.
I have to do it this way as the mis requires a restart and this can not be done by deployment. Anyway. Its works fine in XP but win7 machine just loop. So I must be missing something. Am I using the correct way to look for the app or should I use reg? my code is below.
Cheers
Option Explicit 'Forces variables to be declared
'Define constants
'Declare variables
Dim strComputer
Dim objWMIService
Dim colSoftware
Dim objSoftware
Dim retCode
Dim WshShell
'Set variables
strComputer = "."
'Create objects
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
("Select * from Win32_Product Where PackageName = '*VNC'")
WScript.Echo ("Select * from Win32_Product Where PackageName = '*VNC'")
On Error Resume Next
'Searchs installed programs
For Each objSoftware In colSoftware
WScript.Echo "test quit"
WScript.Quit
Next
'Pause for a period of time
'WScript.Sleep(30000) ' This is 30 seconds
'Installs new EXE from network share
retCode = WshShell.Run("\\Server\VNC\x86\UltraVNC.msi", 0,True) '0 hides window
I have to do it this way as the mis requires a restart and this can not be done by deployment. Anyway. Its works fine in XP but win7 machine just loop. So I must be missing something. Am I using the correct way to look for the app or should I use reg? my code is below.
Cheers
Option Explicit 'Forces variables to be declared
'Define constants
'Declare variables
Dim strComputer
Dim objWMIService
Dim colSoftware
Dim objSoftware
Dim retCode
Dim WshShell
'Set variables
strComputer = "."
'Create objects
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colSoftware = objWMIService.ExecQuery _
("Select * from Win32_Product Where PackageName = '*VNC'")
WScript.Echo ("Select * from Win32_Product Where PackageName = '*VNC'")
On Error Resume Next
'Searchs installed programs
For Each objSoftware In colSoftware
WScript.Echo "test quit"
WScript.Quit
Next
'Pause for a period of time
'WScript.Sleep(30000) ' This is 30 seconds
'Installs new EXE from network share
retCode = WshShell.Run("\\Server\VNC\x86\UltraVNC.msi", 0,True) '0 hides window