Home | Techie Talk | Story Time | About | Contact

Wednesday, July 07, 2010

VBScript to list all Windows Domain in your network

Today when cleaning some old unused folders in my computer, found few VB Scripts which I wrote few years back. I am planning to post them here, regularly. Hope these scripts will be useful for others.

' This vbscript will list all the Windows Domain in the network - using the WinNT namespace
' author email : prathees dot r at gmail dot com

Set nameSpaceObject = GetObject("WinNT:")
For Each domainObject In nameSpaceObject
   WScript.Echo domainObject.Name

How to run the script:
1. Copy the above script to a file - say ListDomain.vbs
2. Execute the script using CScript program. Eg:
C:\> CSCRIPT ListDomain.vbs

Labels: ,


Post a Comment

<< Home