Winscripter
  WSH
  Forums
  Downloads
  Books
  Links
  Amazon




Login
Register

© winscripter.com
1998-2004







Script: Map Network Drive

Posted by on Sunday, January 18, 2004 (PST)

Script: Map Network Drive. One example using name and password, One example without. Uses WScript.Network MapNetworkDrive method.

 


/**
 *    Script:   MapDrive.js
 *    Purpose:  Maps two network drives.
 *              1 - Without name and password
 *              1 - With name and pasword
 *    Author:   Daren Thiel
 *    Date:     19 April 1999
 *    Web:     
http://www.winscripter.com
 *    Note:     Rename this file MapDrive.js
 **/
net = new ActiveXObject( "WScript.Network" );

/**
 * MapNetworkDrive prototype:
 * object.MapNetworkDrive( strDrive,
 *                         strServer\Share,
 *                         [boolSaveToProfile],
 *                         [strName], [strPass] )
 * Note: Remember in JScript we need to use "\\" for each "\"
 **/
net.MapNetworkDrive( "N:", "\\\\sparky\\Open" );
net.MapNetworkDrive( "O:", "\\\\sparky\\Protected", false, "user", "pass" );
 

Comments:

Thanks
By joealbergo on Thursday, July 24, 2008 (PST)

You know I was trying to establish what to rename. Forgive my unexperience....

 

Thanks for the script example though. Im going to try and use this site as much as I can.

 

Reply to this Comment

Add Your Comment



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