Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBScript Equivalent to 'net use' command

Status
Not open for further replies.

djhawthorn

Technical User
Mar 4, 2002
641
AU
Is there a VBScript equivalent to the DOS command

Code:
net use \\servername\ipc$ /user:domain\username *
?

I need to create an authentication pipe to a number of remote servers before running some commands against them... would be nice to do this with VBScript.

[ponder][laughtears] The dumber they think you are, the more surprised they'll be when you kill them! [machinegun][rofl2]
 
Code:
set WshShell = CREATEOBJECT("WScript.Shell")
WshShell.Run("net use \\servername\ipc$ /user:domain\username *")

Brian
 
Thanks...

Brian - I realise you can use the WshShell.Run command to open the DOS box; I was kinda looking for a WSH/VBS equivalent command though (rather than "net use").

Mark - That's for mapping a drive - I specfically only need to create an authentication pipe to the remote machine, not map a drive letter.

Doesn't matter - thanks to you both.

[ponder][laughtears] The dumber they think you are, the more surprised they'll be when you kill them! [machinegun][rofl2]
 
The time you might want to do it is that the machine is of some other domain and you want to access to its resource. You can do it the wmi way or adsi way.

[1] With wmi, raise swbemlocator (and it is where you provide you credential) and then connectserver to raise a wmi service workhorse. From it, you may create a share of type 3 (ipc) through win32_share class.

[2] With adsi, you connect to WinNT: namespace and use opendsoobject method to bind to lanmanserver of the remote machine (and it is where you provide your credential). From the lanmanserver, you can create your ipc$.

Those are the outlines of approaches without using the utility net use.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top