marcsusy Posted October 16, 2013 Posted October 16, 2013 Hello everyone:I have a problem, try to connect to a remote computer using WMI using the following script and I get a permissions error, try to connect to a user with administrative permissions, but always get an error, if someone has an idea of where the problem is I would like to help me.the error I get is Com Error 80041003 Script used: Global $oErrorHandler = ObjEvent("AutoIt.Error", "ObjErrorHandler") Global $NOMEPC = "PC27" Global $sDomain = "Domain" Global $sUserName = "Admin" Global $sPassword = "pass" Global $Addremot = "Add" Global $User = "User" Add_User_Del_Remot() Func Add_User_Del_Remot() $objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator") $objSWbemServices = $objSWbemLocator.ConnectServer($NOMEPC, "rootcimv2", $sDomain&""&$sUserName, $sPassword);1 $colItems = $objSWbemServices.ExecQuery("Select * From Win32_Group Where LocalAccount = TRUE And SID = 'S-1-5-32-544'") $objSWbemServices.Security_.ImpersonationLevel = 3 $objWMIService = ObjGet("winmgmts:" & $NOMEPC & "rootcimv2:Win32_Process") For $oItem in $colItems $admgroup = $oItem.Name Next $cmd = "net localgroup " & $admgroup & " " & $sDomain & "" & $User & " /"&$Addremot $objWMIService.Create($cmd) EndFunc Func ObjErrorHandler() Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oErrorHandler.description & @CRLF & _ "err.windescription:" & @TAB & $oErrorHandler.windescription & @CRLF & _ "err.number is: " & @TAB & hex($oErrorHandler.number,8) & @CRLF & _ "err.lastdllerror is: " & @TAB & $oErrorHandler.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oErrorHandler.scriptline & @CRLF & _ "err.source is: " & @TAB & $oErrorHandler.source & @CRLF & _ "err.helpfile is: " & @TAB & $oErrorHandler.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oErrorHandler.helpcontext _ ) EndFunc
UEZ Posted October 16, 2013 Posted October 16, 2013 Can you try by replacing the line with this?: $objSWbemServices = $objSWbemLocator.ConnectServer($NOMEPC, "\root\cimv2", $sDomain & "\" & $sUserName, $sPassword, "", "", 128) Br, UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now