d

List Domains

list the domains seen by this host. Most environments will only show one.

/**
 *    Script:   listdomains.js
 *    Purpose:  Lists all domains.
 *    Author:   Daren Thiel 
 *    Date:     9 Dec 2000 
 *    Web:      http://www.winscripter.com
 **/

 
/////////////////////////////////////////////
//           Verbose version               //
/////////////////////////////////////////////

var allDomains = GetObject( "WinNT:" );
var domains = new Enumerator( allDomains );

for( ; !domains.atEnd(); domains.moveNext() )
{
  var domain = domains.item();
  WScript.Echo( domain.Name );
}

    
/////////////////////////////////////////////
//           Short version                 //
/////////////////////////////////////////////

var domains = new Enumerator( GetObject( "WinNT:" ) );
for( ; !domains.atEnd(); domains.moveNext() )
    WScript.Echo( domains.item().Name );