List Shares on a Host
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 );
}