Jump to content

Recommended Posts

Posted

What happens if you use _ServListInstalled("machineid") ?

I don't have a nework available right now to test it.

I get the exact same error message.

:)

It´s Only Rock´n´Roll, But I Like It
  • 3 weeks later...
  • Replies 100
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted

I'm having some problems using this UDF.

When i run it on the local machine there is no problem. But when I try on a remote machine I get the following error:

C:\PROGRA~1\AutoIt3\Include\Services.au3 (122) : ==> Variable must be of type "Object".:

$sItems = $Service.ExecQuery("Select * from Win32_Service")

$sItems = $Service^ ERROR

I thing the reason is the failure to create an "Service"-object, because its failed to connect to the remote machine.

In this case the objectnumber is 0 (null) and you have to check for this and returning from function with errorcode.

ex.:

Local $Service = ObjGet("winmgmts:\\" & $Computer & "\root\cimv2")
    ;** Check for Service object **
    if $Service = 0 then return seterror(1,1,"missing service object")    ;On Error return
    Local $sItems = $Service.ExecQuery ("Select * from Win32_Service")

Connect to remote machine

Look at http://msdn2.microsoft.com/en-us/library/aa389290.aspx to get the full information.

Here a short briefing:

Connecting to Remote Computers

The most basic remote connection is from Computer A to a namespace on Computer B where:

  • The same username and password credentials identify an account on Computer B. Because of User Account Control the account on Computer B must be a domain account in the Administrators group. For more information, see User Account Control and WMI.
  • Windows Server 2003, Windows XP, Windows 2000, and Windows NT 4.0: The account on Computer B must be in the Administrator group, but a domain account is not required.
  • The password for the account on Computer A is not blank.
  • Starting with Windows Vista, WMI supports connections to computers running IPv6. However, both Computer A and Computer B must be running IPv6. Either computer may be running IPv4 also. For more information, see IPv6 and IPv4 Support in WMI.
WMI makes no distinction between local and remote access. If no computer name is specified, a connection to WMI defaults to the local computer. ***CUT*** The difference between a local and a remote connection is that users can specify a user name and password in a remote connection, replacing the current user name and password. With a local connection, users cannot override the current name and password.

If you connect to a remote computer in a different domain or using a different user name and password, then you must use the SWbemLocator.ConnectServer method in script.

The following VBScript code example enables you to connect to a remote computer using different credentials. For example, a remote computer in a different domain or connecting to a remote computer requiring a different user name and password. In this case, use the SWbemServices.ConnectServer connection.

' Full Computer Name
' can be found by right-clicking My Computer,
' then click Properties, then click the Computer Name tab)
' or use the computer's IP address
strComputer = "FullComputerName" 
strDomain = "DOMAIN" 
Wscript.StdOut.Write "Please enter your user name:"
strUser = Wscript.StdIn.ReadLine 
Set objPassword = CreateObject("ScriptPW.Password")
Wscript.StdOut.Write "Please enter your password:"
strPassword = objPassword.GetPassword()
 
Set objSWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objSWbemServices = objSWbemLocator.ConnectServer(strComputer, _
    "root\cimv2", _
     strUser, _
     strPassword, _
     "MS_409", _
     "ntlmdomain:" + strDomain)
Set colSwbemObjectSet = _
    objSWbemServices.ExecQuery("Select * From Win32_Process")
For Each objProcess in colSWbemObjectSet
    Wscript.Echo "Process Name: " & objProcess.Name 
Next

OK, it's not AutoIt, if I have time to spend I try to make an AutoIt port

Posted (edited)

Here is one way to run an Autoit exe as a service.

This creates a service to run the ServiceLauncher script, you must restart the PC to see changes:

CreateService.au3:

CreateService("TestService","TestService",'C:\Program Files\TestService\TestServiceLauncher.exe')

Func CreateService($DisplayName, $Description, $ImagePath)
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "Type", "REG_DWORD", 272)
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "Start", "REG_DWORD", 2)
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "ErrorControl", "REG_DWORD", 0)
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "DisplayName", "REG_SZ", $DisplayName)
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "ObjectName", "REG_SZ", "LocalSystem")
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "Description", "REG_SZ", $Description)
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "ImagePath", "REG_EXPAND_SZ", $ImagePath)
EndFunc;==>WriteKeyoÝ÷ Ù8^iËnjV©¦ØZ·*.Á©í¶Þ®éÛMë-IêïÇ»Ûjëh×6MsgBox(4096, "Test", "Test Service is running", 2)  
While 1 
    Sleep(1)
Wend
Edited by random667

It is really sad to see a family torn apart by something as simple as a pack of wolves.

Posted (edited)

Well, it's cool UDF man! :)

Thanks a lot for the UDF, very useful

Edited by slayerz

AUTOIT[sup] I'm lovin' it![/sup]

Posted

Here is one way to run an Autoit exe as a service.

This creates a service to run the ServiceLauncher script, you must restart the PC to see changes:

CreateService.au3:

CreateService("TestService","TestService",'C:\Program Files\TestService\TestServiceLauncher.exe')

Func CreateService($DisplayName, $Description, $ImagePath)
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "Type", "REG_DWORD", 272)
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "Start", "REG_DWORD", 2)
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "ErrorControl", "REG_DWORD", 0)
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "DisplayName", "REG_SZ", $DisplayName)
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "ObjectName", "REG_SZ", "LocalSystem")
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "Description", "REG_SZ", $Description)
    RegWrite("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TestService", "ImagePath", "REG_EXPAND_SZ", $ImagePath)
EndFunc
  • 3 weeks later...
Posted

Not sure where i got this file from but it has _CreateService(...) function. Haven't tested this but seems to be okey. I've attached full file below but here's the function for _CreateService:

;===============================================================================
; Description:   Creates a service on a computer
; Parameters:    $sComputerName - name of the target computer. If empty, the local computer name is used
;                $sServiceName - name of the service to create
;                $sDisplayName - display name of the service
;                $sBinaryPath - fully qualified path to the service binary file
;                               The path can also include arguments for an auto-start service
;                $sServiceUser - [optional] default is LocalSystem
;                                name of the account under which the service should run
;                $sPassword - [optional] default is empty
;                             password to the account name specified by $sServiceUser
;                             Specify an empty string if the account has no password or if the service 
;                             runs in the LocalService, NetworkService, or LocalSystem account
;                 $nServiceType - [optional] default is $SERVICE_WIN32_OWN_PROCESS
;                 $nStartType - [optional] default is $SERVICE_AUTO_START
;                 $nErrorType - [optional] default is $SERVICE_ERROR_NORMAL
;                 $nDesiredAccess - [optional] default is $SERVICE_ALL_ACCESS
;                 $sLoadOrderGroup - [optional] default is empty
;                                    names the load ordering group of which this service is a member
; Requirements:  Administrative rights on the computer
; Return Values: On Success - 1
;                On Failure - 0 and @error is set to extended Windows error code
; Note:          Dependencies cannot be specified using this function
;                Refer to the CreateService page on MSDN for more information
;===============================================================================
Func _CreateService($sComputerName, _
                    $sServiceName, _
                    $sDisplayName, _
                    $sBinaryPath, _
                    $sServiceUser = "LocalSystem", _
                    $sPassword = "", _
                    $nServiceType = 0x00000010, _
                    $nStartType = 0x00000002, _
                    $nErrorType = 0x00000001, _
                    $nDesiredAccess = 0x000f01ff, _
                    $sLoadOrderGroup = "")
   Local $hAdvapi32
   Local $hKernel32
   Local $arRet
   Local $hSC
   Local $lError = -1   

   $hAdvapi32 = DllOpen("advapi32.dll")
   If $hAdvapi32 = -1 Then Return 0
   $hKernel32 = DllOpen("kernel32.dll")
   If $hKernel32 = -1 Then Return 0
   $arRet = DllCall($hAdvapi32, "long", "OpenSCManager", _
                    "str", $sComputerName, _
                    "str", "ServicesActive", _
                    "long", $SC_MANAGER_ALL_ACCESS)
   If $arRet[0] = 0 Then
      $arRet = DllCall($hKernel32, "long", "GetLastError")
      $lError = $arRet[0]
   Else
      $hSC = $arRet[0]
      $arRet = DllCall($hAdvapi32, "long", "OpenService", _
                       "long", $hSC, _
                       "str", $sServiceName, _
                       "long", $SERVICE_INTERROGATE)
      If $arRet[0] = 0 Then
         $arRet = DllCall($hAdvapi32, "long", "CreateService", _
                          "long", $hSC, _
                          "str", $sServiceName, _
                          "str", $sDisplayName, _
                          "long", $nDesiredAccess, _
                          "long", $nServiceType, _
                          "long", $nStartType, _
                          "long", $nErrorType, _
                          "str", $sBinaryPath, _
                          "str", $sLoadOrderGroup, _
                          "ptr", 0, _
                          "str", "", _
                          "str", $sServiceUser, _
                          "str", $sPassword)
         If $arRet[0] = 0 Then            
            $arRet = DllCall($hKernel32, "long", "GetLastError")
            $lError = $arRet[0]
         Else
            DllCall($hAdvapi32, "int", "CloseServiceHandle", "long", $arRet[0])
         EndIf
      Else
         DllCall($hAdvapi32, "int", "CloseServiceHandle", "long", $arRet[0])
      EndIf      
      DllCall($hAdvapi32, "int", "CloseServiceHandle", "long", $hSC)
   EndIf
   DllClose($hAdvapi32)
   DllClose($hKernel32)   
   If $lError <> -1 Then 
      SetError($lError)
      Return 0
   EndIf
   Return 1
EndFunc

Hope someone can test and say if it works or not :)

servicecontrol.au3

My little company: Evotec (PL version: Evotec)

Posted

Would love to see a function added to modify some of the service's settings. Specifically right now, I need one that will change the state of the service between the Automatic, Manual, or Disabled states. If it's already here I don't see it.

My Projects:DebugIt - Debug your AutoIt scripts with DebugIt!
Posted

Would love to see a function added to modify some of the service's settings. Specifically right now, I need one that will change the state of the service between the Automatic, Manual, or Disabled states. If it's already here I don't see it.

There is one. Check my post (it's on this page post 6)

My little company: Evotec (PL version: Evotec)

  • 3 months later...
Posted

There is one. Check my post (it's on this page post 6)

Does anyone know of a script that does this using dllcall?? i need to do this using the API...

I am making a script that sets a service to disabled, stops the service, logs close time, sets service to auto, then starts the service...

i have everything working but the setting of the service state...

Thx

D

Posted (edited)

Does anyone know of a script that does this using dllcall?? i need to do this using the API...

I am making a script that sets a service to disabled, stops the service, logs close time, sets service to auto, then starts the service...

i have everything working but the setting of the service state...

Thx

D

Why this has to be DLLCALL? It's simply reg changing.

Edited by MadBoy

My little company: Evotec (PL version: Evotec)

Posted (edited)

Why this has to be DLLCALL? It's simply reg changing.

I am replicating the start method of a program i am testing. the developer has chosen to use the Win32 API to disable the service...

This is what i have so far for the disabling, but it is crashing...

Basically modified the code by SumTingWong (pacman):

Global $STANDARD_RIGHTS_REQUIRED = 0x000F0000
Global $SC_MANAGER_CONNECT = 0x0001
Global $SC_MANAGER_CREATE_SERVICE = 0x0002
Global $SC_MANAGER_ENUMERATE_SERVICE = 0x0004
Global $SC_MANAGER_LOCK = 0x0008
Global $SC_MANAGER_QUERY_LOCK_STATUS = 0x0010
Global $SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020

Global $SC_MANAGER_ALL_ACCESS = BitOR($STANDARD_RIGHTS_REQUIRED, _
                                     $SC_MANAGER_CONNECT, _
                                     $SC_MANAGER_CREATE_SERVICE, _
                                     $SC_MANAGER_ENUMERATE_SERVICE, _
                                     $SC_MANAGER_LOCK, _
                                     $SC_MANAGER_QUERY_LOCK_STATUS, _
                                     $SC_MANAGER_MODIFY_BOOT_CONFIG)
                                    
Global $SERVICE_QUERY_CONFIG = 0x0001
Global $SERVICE_CHANGE_CONFIG = 0x0002
Global $SERVICE_QUERY_STATUS = 0x0004
Global $SERVICE_ENUMERATE_DEPENDENTS = 0x0008
Global $SERVICE_START = 0x0010
Global $SERVICE_STOP = 0x0020
Global $SERVICE_PAUSE_CONTINUE = 0x0040
Global $SERVICE_INTERROGATE = 0x0080
Global $SERVICE_USER_DEFINED_CONTROL = 0x0100
Global $SERVICE_AUTO_START = 0x00000002
Global $SERVICE_DISABLED = 0x00000004
Global $SERVICE_NO_CHANGE = 0xffffffff
Global $SERVICE_ALL_ACCESS = BitOR($STANDARD_RIGHTS_REQUIRED, _
                                  $SERVICE_QUERY_CONFIG, _
                                  $SERVICE_CHANGE_CONFIG, _
                                  $SERVICE_QUERY_STATUS, _
                                  $SERVICE_ENUMERATE_DEPENDENTS, _
                                  $SERVICE_START, _
                                  $SERVICE_STOP, _
                                  $SERVICE_PAUSE_CONTINUE, _
                                  $SERVICE_INTERROGATE, _
                                  $SERVICE_USER_DEFINED_CONTROL, _
          $SERVICE_AUTO_START, _
          $SERVICE_DISABLED, _
          $SERVICE_NO_CHANGE)

Global $SERVICE_CONTROL_STOP = 0x00000001
Global $SERVICE_CONTROL_INTERROGATE = 0x00000004

Func DisableService($sServiceName)
  Local $arRet
  Local $hSC
  Local $hService
  Local $lError = -1

  $arRet = DllCall("advapi32.dll", "long", "OpenSCManager", _
                   "str", "", _
                   "str", "ServicesActive", _ 
                   "long", $SC_MANAGER_CONNECT)
  If $arRet[0] = 0 Then
     $arRet = DllCall("kernel32.dll", "long", "GetLastError")
     $lError = $arRet[0]
  Else
     $hSC = $arRet[0]
     $arRet = DllCall("advapi32.dll", "long", "OpenService", _
                      "long", $hSC, _
                      "str", $sServiceName, _
                      "long", $SERVICE_CHANGE_CONFIG)
     If $arRet[0] = 0 Then
        $arRet = DllCall("kernel32.dll", "long", "GetLastError")
        $lError = $arRet[0]
     Else
        $hService = $arRet[0]
        $arRet = DllCall("advapi32.dll", "int", "ChangeServiceConfig", _
                         "long", $hService, _
                         "long",  $SERVICE_NO_CHANGE, _
                         "long", $SERVICE_DISABLED, _
                         "long", $SERVICE_NO_CHANGE)
        If $arRet[0] = 0 Then
           $arRet = DllCall("kernel32.dll", "long", "GetLastError")
           $lError = $arRet[0]
        EndIf
        DllCall("advapi32.dll", "int", "CloseServiceHandle", "long", $hService)      
     EndIf
     DllCall("advapi32.dll", "int", "CloseServiceHandle", "long", $hSC)
  EndIf
  If $lError <> -1 Then SetError($lError)
      EndFunc

It is fine with syntax, but whenever i run it, with the spooler service (print spooler) which i am using as a guinea pig service to get my head round this (first time using dllcall in autoit), it crashes out - whether the service is started or stopped...

If i can get this working, my script will be done - as it is just a case of changing the $SERVICE_DISABLED to $SERVICE_AUTO_START??

Edited by Darkseed
Posted

Figured it out... forgot to declare the NULL variables lol - always the obvious stuff... also adjusted the access management for the call...

Here is the code (only done two runs so might have some bugs)... it changes the service to disabled, but will not update until the service has been stopped & started... there is an API to auto update.. i'll work on that now...

:)

Global $STANDARD_RIGHTS_REQUIRED = 0x000F0000
Global $SC_MANAGER_CONNECT = 0x0001
Global $SC_MANAGER_CREATE_SERVICE = 0x0002
Global $SC_MANAGER_ENUMERATE_SERVICE = 0x0004
Global $SC_MANAGER_LOCK = 0x0008
Global $SC_MANAGER_QUERY_LOCK_STATUS = 0x0010
Global $SC_MANAGER_MODIFY_BOOT_CONFIG = 0x0020

Global $SC_MANAGER_ALL_ACCESS = BitOR($STANDARD_RIGHTS_REQUIRED, _
                                     $SC_MANAGER_CONNECT, _
                                     $SC_MANAGER_CREATE_SERVICE, _
                                     $SC_MANAGER_ENUMERATE_SERVICE, _
                                     $SC_MANAGER_LOCK, _
                                     $SC_MANAGER_QUERY_LOCK_STATUS, _
                                     $SC_MANAGER_MODIFY_BOOT_CONFIG)
                                    
Global $SERVICE_QUERY_CONFIG = 0x0001
Global $SERVICE_CHANGE_CONFIG = 0x0002
Global $SERVICE_QUERY_STATUS = 0x0004
Global $SERVICE_ENUMERATE_DEPENDENTS = 0x0008
Global $SERVICE_START = 0x0010
Global $SERVICE_STOP = 0x0020
Global $SERVICE_PAUSE_CONTINUE = 0x0040
Global $SERVICE_INTERROGATE = 0x0080
Global $SERVICE_USER_DEFINED_CONTROL = 0x0100
Global $SERVICE_AUTO_START = 0x00000002
Global $SERVICE_DISABLED = 0x00000004
Global $SERVICE_NO_CHANGE = 0xffffffff
Global $SERVICE_ERROR_IGNORE = 0x00000000
Global $SERVICE_ALL_ACCESS = BitOR($STANDARD_RIGHTS_REQUIRED, _
                                  $SERVICE_QUERY_CONFIG, _
                                  $SERVICE_CHANGE_CONFIG, _
                                  $SERVICE_QUERY_STATUS, _
                                  $SERVICE_ENUMERATE_DEPENDENTS, _
                                  $SERVICE_START, _
                                  $SERVICE_STOP, _
                                  $SERVICE_PAUSE_CONTINUE, _
                                  $SERVICE_INTERROGATE, _
                                  $SERVICE_USER_DEFINED_CONTROL, _
                                  $SERVICE_AUTO_START, _
                                  $SERVICE_DISABLED, _
                                  $SERVICE_NO_CHANGE, _
                                  $SERVICE_ERROR_IGNORE)

Global $SERVICE_CONTROL_STOP = 0x00000001
Global $SERVICE_CONTROL_INTERROGATE = 0x00000004

DisableService("Spooler")

Func DisableService($sServiceName)
  Local $arRet
  Local $hSCManager
  Local $hService
  Local $lError = -1

  $arRet = DllCall("advapi32.dll", "long", "OpenSCManager", _
                   "str", "", _
                   "str", "ServicesActive", _ 
                   "long", $SC_MANAGER_ALL_ACCESS)
  If $arRet[0] = 0 Then
     $arRet = DllCall("kernel32.dll", "long", "GetLastError")
     $lError = $arRet[0]
    
  Else
     $hSCManager = $arRet[0]
     $arRet = DllCall("advapi32.dll", "long", "OpenService", _
                      "long", $hSCManager, _
                      "str", $sServiceName, _
                      "long", $SERVICE_CHANGE_CONFIG)
     If $arRet[0] = 0 Then
        $arRet = DllCall("kernel32.dll", "long", "GetLastError")
        $lError = $arRet[0]
        
    Else
    ; Change the service start type
        $hService = $arRet[0]
        $arRet = DllCall("advapi32.dll", "int", "ChangeServiceConfig", _
                         "long", $hService, _
                         "long", $SERVICE_NO_CHANGE, _
                         "long", $SERVICE_DISABLED, _
                         "long", $SERVICE_NO_CHANGE, _
                         "int", "NULL", _
                         "int", "NULL", _
                         "int", "NULL", _
                         "int", "NULL", _
                         "int", "NULL", _
                         "int", "NULL", _
                         "int", "NULL")
        If $arRet[0] = 0 Then
           $arRet = DllCall("kernel32.dll", "long", "GetLastError")
           $lError = $arRet[0]

        EndIf
        DllCall("advapi32.dll", "int", "CloseServiceHandle", "long", $hService)      
     EndIf
     DllCall("advapi32.dll", "int", "CloseServiceHandle", "long", $hSCManager)
  EndIf
  If $lError <> -1 Then SetError($lError)
      EndFunc

Any comments/queries are welcome.

Thx,

D

  • 3 months later...
Posted

Is it possible to change these UDF functions so that a domain\username and password can be passed to them, or the ability to set a global username and password for all functions?

Posted

Is it possible to change these UDF functions so that a domain\username and password can be passed to them, or the ability to set a global username and password for all functions?

See post #22 in the thread.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

Hi, i did read that post, but was not sure on how to port that to AutoIT?

CODE

$Computer = "FullComputerName"

$Domain = "DOMAIN"

$User = InputBox("User Name", "Please enter your user name:")

$Password = InputBox("Password", "Please enter your password:", "", "*")

$objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator")

$objSWbemServices = $objSWbemLocator.ConnectServer($Computer, _

"root\cimv2", _

$User, _

$Password, _

"MS_409", _

"ntlmdomain:" + $Domain)

$colSwbemObjectSet = _

$objSWbemServices.ExecQuery("Select * From Win32_Process")

For $objProcess In $colSWbemObjectSet

MsgBox(0, "Output", "Process Name: " & objProcess.Name

Next

This is just off the top of my head but it will be pretty close.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted

Looks good without using/testing :D

Anyway, has anyone tested this in Vista?

I think when you change something with the Windows services you have to have admin rights.

You should check the OS and maybe call #RequireAdmin.

That's where others get to do their part of the process. I've already done mine.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted (edited)

$Computer = "COMPUTERNAME"
$Domain = "DOMAIN"
$User = InputBox("User Name", "Please enter your user name:")
$Password = InputBox("Password", "Please enter your password:", "", "*")
$objSWbemLocator = ObjCreate("WbemScripting.SWbemLocator")
$objSWbemServices = $objSWbemLocator.ConnectServer($Computer, _
"root\cimv2", _
$User, _
$Password, _
"MS_409", _
"ntlmdomain:" + $Domain)
$colSwbemObjectSet = _
$objSWbemServices.ExecQuery("Select * From Win32_Process")
For $objProcess In $colSWbemObjectSet
MsgBox(0, "Output", "Process Name: " & $objProcess.Name)
Next

.. am getting;

c:\Scripts\services.au3 (18) : ==> The requested action with this object has failed.: 
$objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" + $Domain) 
$objSWbemServices = $objSWbemLocator.ConnectServer($Computer, "root\cimv2", $User, $Password, "MS_409", "ntlmdomain:" + $Domain)^ ERROR

I obviously change the $Computer and $Domain.

Edited by ale1981

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...