Provides access to the shared resources on the network to which your computer is connected.
Syntax
Set WshNetwork = CreateObject("Wscript.Network")
Properties:
UserName The username variable, likely the SAM Account Name (the pre-Windows 2000 name)
UserDomain The NetBIOS domain name
ComputerName This is the NetBIOS computer name
Methods
AddWindowsPrinterConnection Add a printer in Windows 2000 and higher
AddPrinterConnection Add a printer in older systems
EnumNetworkDrives List the mapped drives on the computer
EnumPrinterConnections List the installed printers
MapNetworkDrive Map a network drive
RemoveNetworkDrive Remove a network drive
RemovePrinterConnection Remove a printer connection
SetDefaultPrinter Set the default printer
Example
Set WshNetwork = WScript.CreateObject("WScript.Network")
WScript.Echo "Domain = " & WshNetwork.UserDomain
WScript.Echo "Computer Name = " & WshNetwork.ComputerName
WScript.Echo "User Name = " & WshNetwork.UserName
“It is possible to store the mind with a million facts and still be entirely uneducated” ~ Alec Bourne
Related:
Shell + Shell.Application objects/methods