degid
Newbie | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору Есть скрипт на vbscript, меняет рабочую группу, тут нашел пример всовывания vbscript в AutoIT, но он чет вылетает на с ошибкой Исходный скрипт: Код: Const JOIN_DOMAIN = 1 Const ACCT_CREATE = 2 Const ACCT_DELETE = 4 Const WIN9X_UPGRADE = 16 Const DOMAIN_JOIN_IF_JOINED = 32 Const JOIN_UNSECURE = 64 Const MACHINE_PASSWORD_PASSED = 128 Const DEFERRED_SPN_SET = 256 Const INSTALL_INVOCATION = 262144 strDomain = "NewGr" Set objNetwork = CreateObject("WScript.Network") strComputer = objNetwork.ComputerName Set objComputer = GetObject("winmgmts:{impersonationLevel=Impersonate}!\\" & _ strComputer & "\root\cimv2:Win32_ComputerSystem.Name='" & strComputer & "'") ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain) | AutoIT Код: $ProcessName = "AutoIt3.exe" $RetArr = _ProcessExistsVbs($ProcessName) If IsArray($RetArr) Then MsgBox(64, "", "Process <" & $RetArr[1] & "> exists." & @LF & @LF & _ "The returned PID is: " & $RetArr[2] & @LF & @LF & _ "Returned Executable Path is: " & @LF & $RetArr[3] & @LF & @LF & _ "Command Line of executed process is: " & @LF & $RetArr[4]) Func _ProcessExistsVbs($ProcName) Local $Code = "" $Code &= 'Function ProcessExists(ProcessName)' & @LF $Code &= 'Const JOIN_DOMAIN = 1' & @LF $Code &= 'Const ACCT_CREATE = 2' & @LF $Code &= 'Const ACCT_DELETE = 4' & @LF $Code &= 'Const WIN9X_UPGRADE = 16' & @LF $Code &= 'Const DOMAIN_JOIN_IF_JOINED = 32' & @LF $Code &= 'Const JOIN_UNSECURE = 64' & @LF $Code &= 'Const MACHINE_PASSWORD_PASSED = 128' & @LF $Code &= 'Const DEFERRED_SPN_SET = 256' & @LF $Code &= 'Const INSTALL_INVOCATION = 262144' & @LF $Code &= 'strDomain = "NewGr"' & @LF $Code &= 'Set objNetwork = CreateObject("WScript.Network")' & @LF $Code &= 'strComputer = objNetwork.ComputerName' & @LF $Code &= "Set objComputer = GetObject(" & """winmgmts:{impersonationLevel=Impersonate}!\\""" & " & strComputer & " & """\root\cimv2:Win32_ComputerSystem.Name='" & " & strComputer & " & "'" & @LF $Code &= 'ReturnValue = objComputer.JoinDomainOrWorkGroup(strDomain)' & @LF $Code &= 'End Function' Local $VbsObj = ObjCreate("ScriptControl") If @error Then Return SetError(1, 0, -1) $VbsObj.Language = "vbscript" $VbsObj.AddCode($Code) Local $RetArr = $VbsObj.[i]Run[/i]("ProcessExists", $ProcName) If $RetArr = 0 Then Return SetError(0, 0, 0) Return $RetArr EndFunc | в общем, ругается он на эту строчку: Код: $Code &= "Set objComputer = GetObject(" & """winmgmts:{impersonationLevel=Impersonate}!\\""" & " & strComputer & " & """\root\cimv2:Win32_ComputerSystem.Name='" & " & strComputer & " & "'" & @LF | Ошибка: The requested action with this object has failed. подскажите плиз, что ему не хватает? | Всего записей: 31 | Зарегистр. 26-10-2006 | Отправлено: 18:16 02-06-2010 | Исправлено: degid, 14:38 03-06-2010 |
|