Hello Squashman,
sorry - yes, after some tests I can confirm that the problem is not the CMD command generally.
I start the command remote - via WMI.
I made some tests. Result is: Make the remote system starting the the CMD command works.
But: You can't make the remote system do something on a third system!
Starting the test app on the remote system - it works. The CMD command can create the txt file on a local drive on the remote system. But when you want the txt be created on a third system it fails.
Same result:
When you make the remote system create the txt on ofe of its local drives and then make it move the txt on a third system via CMD command, it fails.
It is not a CMD/DOS/Batch problem ... it is a problem concerning WMI. It seems to be a kind of security problem.
Code: Select all
Function funct_test()
Dim objWMIService
Dim objProcess
Dim strCMDApp, strCMDLog, strCMDFull
Dim lngReturn
Dim intPID
Set objLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objLocator.ConnectServer("192.168.0.5", "root\cimv2", "TEST-PC\testuser", "123456789")
strCMDApp = """C:\Program Files\testapp\testapp.exe"""
strCMDLog = """\\192.168.0.7\log\log.txt"""
strCMDFull = "cmd /von /c ""call " & strCMDApp & " &>" & strCMDLog & " echo !errorlevel!"""
Set objProcess = objWMIService.Get("Win32_Process")
lngReturn = objProcess.create(strCMDFull, Null, Null, intPID)
Set objProcess = Nothing
Set objWMIService = Nothing
Set objLocator = Nothing
End Function