PC Tools - Essential tools for your PC | United States & Canada
Search
 
 
Features
 
 
Newsletter
 
Scripting Home > WSH Reference Guide

WScript.Network Object

Description

The WScript.Network object provides access to Windows networking methods to easily control functions such as adding and displaying network shares and printers. It also exposes several networking properties including the current username, domain and computer name.

Example

'VBScript Example
Set WshNetwork = WScript.CreateObject("WScript.Network")

WScript.Echo "User Name: " & WshNetwork.UserName
WshNetwork.MapNetworkDrive "S:", "\\server\share"

'JScript Example
var WshNetwork = new ActiveXObject("WScript.Network");

WScript.Echo("User Name: " + WshNetwork.UserName);
WshNetwork.MapNetworkDrive ("S:", "\\server\share");
 
  Copyright © 1998-2010 PC Tools. All rights reserved. Privacy Policy | Legal Notice