Results 1 to 2 of 2

Thread: variable in getobject

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Location
    Netherlands
    Posts
    27
    In the following source I want the Host Server1 replace by an inputbox variable. How do I do that???

    for each Service in
    GetObject("winmgmts:{impersonationLevel=impersonate}!//Server1").Instan
    cesOf ("Win32_service")
    WScript.Echo Service.DisplayName
    Next


    Thnx.....
    HansZ

  2. #2

    Thread Starter
    Junior Member
    Join Date
    Feb 2000
    Location
    Netherlands
    Posts
    27
    Here is the solution, I have found it meanwhile somewhere else:
    MyServer = inputbox("Enter Servername")
    set computerobj = getobject("WinNT://" + MyServer)
    ComputerObj.Filter = Array("Service")
    For Each Service in ComputerObj
    WScript.Echo "Service display name = " & Service.DisplayName
    WScript.Echo "Service account name = " & Service.ServiceAccountName
    Next

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width