Hi
i have to call a bat file in another server from my local machine. BAT file may not be in the share folder.
Dim
options As
New System.Management.ConnectionOptions
Dim path
As
New System.Management.ManagementPath("\\"
& strMachineName & "\root\cimv2:Win32_Process")
Dim scope
As
New System.Management.ManagementScope(path, options)
Dim opt
As
New System.Management.ObjectGetOptions()
Dim classInstance
As
New System.Management.ManagementClass(scope, path, opt)
Dim inParams
As System.Management.ManagementBaseObject = classInstance.GetMethodParameters("Create")
"CommandLine") =
strCommand' Execute the method and obtain the return
values.
Dim outParams
As System.Management.ManagementBaseObject = classInstance.InvokeMethod("Create",
inParams, Nothing)
Return
CStr(outParams("returnValue"))
'& " Process ID: {0}" & CStr(outParams("processId"))
For calling a remote VBScript, i used "cscript c:\log.vbs" in the place of
strCommand. Its working fine.
For callinf=g the bat file i used "wscript.shell C:\log.bat". It didn't work
From the remote VBScript i tried to call the bat file. The vbscript failed to invoke bat file.
Can anyone give me a solution?
inParams(
scope.Connect()
options.Username = strUserName
options.Password = strPassword