Winscripter
  WSH
  Forums
  Downloads
  Books
  Links
  Amazon




Login
Register

© winscripter.com
1998-2004







List Shares on a Server

Posted by on Friday, January 16, 2004 (PST)

List shares of a server in a domain.
/**
 *    Script:   listShares.js
 *    Purpose:  Lists shares on a specified server is a domain.
 *    Author:   Daren Thiel
 *    Date:     4 Nov 2000
 *    Web:      http://www.winscripter.com
 **/

WScript.Echo( listShares( "yourdomain", "someserver" ) ); 
 
function listShares( domain, host )
{
    var list = "Shares on \\\\" + domain + "\\" + host + "\n";
    list += "=======================================\n";
    try	
    {
        var fileservice = GetObject( "WinNT://" + domain + "/" + host + "/Lanmanserver" );
	
        var e = new Enumerator( fileservice );
        for( ; !e.atEnd(); e.moveNext() )
        {
            var share = e.item();
            list += share.Name + "\n";
        }
    } 
    catch( e ) 
    {
        list += "Error: " + e.description;
    }
    return( list );
}




WSH and ADSI Administrative Scripting

New Articles
  • List installed COM objects and associated ProgIDs
    Script: Lists all COM Objects and their associated ProgIDs (If available). Win32_ClassicCOMClassSetting

  • Script: File Rotator
    Script: Rotate files where the most current file has the lowest number in the archive. When files exceed the retention period, they are deleted. Typically used for log files, backups, etc..

  • Script: Create IIS Website and DNS record
    Script: Dan Casier sent me this script that will create a website and appropriate DNS record. The script is intended for Windows 2000 Server with local DNS and necessary DNS mof installed.


  • Winscripter   |  WSH   |  Forums   |  Downloads   |  Books   |  Links   |  Amazon