locked
I get Error 80041002 When I try to connect another computer in a network. RRS feed

  • Question

  • Function startExe(sstrComputer, sstrEXE)
        startExe = False
        Set sobjWMIService = GetObject("winmgmts:\\" & sstrComputer & "\root\cimv2:Win32_Process")
            sintReturn = sobjWMIService.Create(sstrEXE, null, null, sintProcessID)
            Select Case sintReturn
                Case 0 'Successful Completion
                    startExe = True
                    startExeStatus = "Successful Completion"
                Case 2 'Access Denied
                    startExe = False
                    startExeStatus = "Access Denied"
                Case 3 'Insufficient Privilege
                    startExe = False
                    startExeStatus = "Insufficient Privilege"
                Case 8 'Unknown Failure
                    startExe = False
                    startExeStatus = "Unknown Failure"
                Case 9 'Path not found
                    startExe = False
                    startExeStatus = "Path not found"
                Case 21 'Invalid Parameter
                    startExe = False
                    startExeStatus = "Invalid Parameter"
                Case Else 
                    startExe = False
                    startExeStatus = "Error code " & sintReturn & " not found"
            End Select 
    End Function 
    
    result = startExe("LZ-DC1-2K8","notepad.exe")
    I'm new to Scripting, I tried running this script from a computer(NETBIOS - "LZ-DC2-2K8"). I get an error with code - 80041002. How do I get the object of a computer in the network with VBScript. Any kind of help would be appreciated, Thanks.
    • Moved by Bill_Stewart Monday, April 30, 2018 9:05 PM This is not "look stuff up for me" forum
    Wednesday, February 14, 2018 5:43 AM

All replies