I have a script below that is giving me the error, i cannot find or see anything wrong with it, can anyone help?
Apparently the compilation error is at line 28 col 2, i have indicated the line with a *
Dim objShell, vRunObject
dim filesys, getname, path,
Set objShell = CreateObject("Wscript.Shell")
path = filesys.GetAbsolutePathName("c:\windows\system32\r_server.exe")
vRunObject = "cmd /K " & Chr(34) & "c:\windows\system32\r_server.exe /stop" & Chr(34)
objShell.run vRunObject,0
WaitForProcess ".", "r_server.exe"
Sub WaitForProcess(strComputer, strProcess)
Dim filesys
Dim wmiQuery : wmiQuery = "Select * From Win32_Process Where Name='" _
& strProcess & "'"
Dim objWMIService : Set objWMIService = GetObject("winmgmts:\\" & strComputer _
& "\root\cimv2")
Dim colItems : Set colItems = objWMIService.ExecQuery(wmiQuery)
Dim intProcCount : intProcCount = colItems.Count
Set filesys = CreateObject("Scripting.FileSystemObject")
Do While intProcCount > 0
Set colItems = objWMIService.ExecQuery(wmiQuery)
* intProcCount = colItems.Count
Loop
If filesys.FileExists(path) Then
filesys.DeleteFile path
End If
End Sub
Apparently the compilation error is at line 28 col 2, i have indicated the line with a *
Dim objShell, vRunObject
dim filesys, getname, path,
Set objShell = CreateObject("Wscript.Shell")
path = filesys.GetAbsolutePathName("c:\windows\system32\r_server.exe")
vRunObject = "cmd /K " & Chr(34) & "c:\windows\system32\r_server.exe /stop" & Chr(34)
objShell.run vRunObject,0
WaitForProcess ".", "r_server.exe"
Sub WaitForProcess(strComputer, strProcess)
Dim filesys
Dim wmiQuery : wmiQuery = "Select * From Win32_Process Where Name='" _
& strProcess & "'"
Dim objWMIService : Set objWMIService = GetObject("winmgmts:\\" & strComputer _
& "\root\cimv2")
Dim colItems : Set colItems = objWMIService.ExecQuery(wmiQuery)
Dim intProcCount : intProcCount = colItems.Count
Set filesys = CreateObject("Scripting.FileSystemObject")
Do While intProcCount > 0
Set colItems = objWMIService.ExecQuery(wmiQuery)
* intProcCount = colItems.Count
Loop
If filesys.FileExists(path) Then
filesys.DeleteFile path
End If
End Sub