Windows VBScript programming ...

Sharky Forums


Results 1 to 5 of 5

Thread: Windows VBScript programming ...

  1. #1
    Mako Shark slavik's Avatar
    Join Date
    May 2001
    Location
    Brooklyn
    Posts
    3,308

    Windows VBScript programming ...

    Does anyone know where I can get good documentation on the ADSI providers that are used in VBScript?

    (Something like WMI Object browser, but for ADSI).

    I've looked through MSDN but couldn't find anything.
    Activation? What activation?
    Quote Originally Posted by Geekkit (from ubuntu forums regarding 'goto' statement)
    Yep it sure does. So does crack cocaine. Existence is not a valid endorsement for being acceptable.
    Quote Originally Posted by Linus Torvalds
    Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it

  2. #2
    Mako Shark slavik's Avatar
    Join Date
    May 2001
    Location
    Brooklyn
    Posts
    3,308
    EDIT: Different problem, but did not want to start a new thread.

    So far I have this piece of VBScript code to get the computer name

    Code:
    Set objWMIService = GetObject("winmgmts://./root/cimv2")
    Set objComputerSystem = _
    	objWMIService.ExecQuery("select name from Win32_ComputerSystem")
    For Each objIterator In objComputerSystem
    	GetSystemName = objIterator.Name
    Next
    My understanding is that the query returns a collection of items, what is the simplest way to turn this collection into an array?
    Last edited by slavik; 06-13-2007 at 04:02 PM.
    Activation? What activation?
    Quote Originally Posted by Geekkit (from ubuntu forums regarding 'goto' statement)
    Yep it sure does. So does crack cocaine. Existence is not a valid endorsement for being acceptable.
    Quote Originally Posted by Linus Torvalds
    Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it

  3. #3
    Ultra Great White Shark!! richardginn's Avatar
    Join Date
    Feb 2001
    Posts
    16,118
    You are going to have to dim some array with like 50 items in it or how many you think are going to need.

    Then under the GetSystemName = objIterator.Name line of code you will have some code that will put some info into the array. Then one line of code that will move over one position in the array.
    www.myeducational plan.com-come see my plan to fix the USA educational system. I hope this is sig legal. Major Site Design Update on July 18, 2006. On June 18, 2009 passed the 10,000 post mark. December 24, 2009: Major Theme change and more....

  4. #4
    Mako Shark slavik's Avatar
    Join Date
    May 2001
    Location
    Brooklyn
    Posts
    3,308
    so far, I just ReDim Preserve the array. I think that there is a way to get the count of the items ... going to look into it
    Activation? What activation?
    Quote Originally Posted by Geekkit (from ubuntu forums regarding 'goto' statement)
    Yep it sure does. So does crack cocaine. Existence is not a valid endorsement for being acceptable.
    Quote Originally Posted by Linus Torvalds
    Only wimps use tape backup: _real_ men just upload their important stuff on ftp, and let the rest of the world mirror it

  5. #5
    Hammerhead Shark
    Join Date
    Feb 2001
    Posts
    1,612
    Well since it is a SWbemObjectSet, you can always use the .Count property, which iterates through the entire collection and returns how many there are. (Not efficient.)

    http://msdn2.microsoft.com/En-US/library/aa393762.aspx

    But shouldn't it only return one computer name anyway? Or are you just thinking in general, not for that particular query?

    I don't know about your ADSI providers question though. I know ADSIEdit is the tool to look at AD data, but I've never done VBScript work with it, so I don't know exactly what an ADSI provider is.

Posting Permissions

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