vbs script to connect/map drive ...
#2
Scooby Regular
Join Date: Mar 2002
Location: www.scoobyzone.co.uk
Posts: 2,082
Likes: 0
Received 0 Likes
on
0 Posts
yeah i was working along the lines of response 2 on friday - cheers guys...
p.s. the other domain is run by the other IT dept, who are evil >( and make no effort to help.. so trusts etc wont be happening
[Edited by snowcrash - 2/2/2003 11:08:00 AM]
p.s. the other domain is run by the other IT dept, who are evil >( and make no effort to help.. so trusts etc wont be happening
[Edited by snowcrash - 2/2/2003 11:08:00 AM]
#3
Scooby Regular
Join Date: Mar 2002
Location: www.scoobyzone.co.uk
Posts: 2,082
Likes: 0
Received 0 Likes
on
0 Posts
hi guys,
anyone got a vbs script to hand to allow a user to connect to a shared folder, now this is the difficult bit, the shared folder is on another domain (the users have different usernames and pass'es for the other domain), so the script will have to:
a) auth the user on the other domain
b) map drive on the other domain
cheers 4 any info
simon
anyone got a vbs script to hand to allow a user to connect to a shared folder, now this is the difficult bit, the shared folder is on another domain (the users have different usernames and pass'es for the other domain), so the script will have to:
a) auth the user on the other domain
b) map drive on the other domain
cheers 4 any info
simon
#4
This should do want you are looking for. I have assumed that the required shares would be hardcoded in the script and the users credentials are entered as parameters when the script is run:
Option Explicit
Dim oWshNetwork
Set oWshNetwork = WScript.CreateObject("WScript.Network")
If (WScript.Arguments.Count < 2) Then
WScript.Echo "Script usage: MapNetworkDrive.vbs <user> <password>"
WScript.Quit(1)
End If
' object.MapNetworkDrive(strLocalName, strRemoteName, [bUpdateProfile], [strUser], [strPassword])
'
On Error Resume Next
oWshNetwork.MapNetworkDrive "I:", "\\servername\sharename", False, WScript.Arguments(0), WScript.Arguments(1)
If (Err.Number <> 0) Then
WScript.Echo "Error: " & Err.Number & ": " & Err.Description
WScript.Quit(1)
End If
On Error Goto 0
To use the id of a user on another domain to map the network drive:
- Scriptname.vbs domain\username password
Cheers
Nigel
Option Explicit
Dim oWshNetwork
Set oWshNetwork = WScript.CreateObject("WScript.Network")
If (WScript.Arguments.Count < 2) Then
WScript.Echo "Script usage: MapNetworkDrive.vbs <user> <password>"
WScript.Quit(1)
End If
' object.MapNetworkDrive(strLocalName, strRemoteName, [bUpdateProfile], [strUser], [strPassword])
'
On Error Resume Next
oWshNetwork.MapNetworkDrive "I:", "\\servername\sharename", False, WScript.Arguments(0), WScript.Arguments(1)
If (Err.Number <> 0) Then
WScript.Echo "Error: " & Err.Number & ": " & Err.Description
WScript.Quit(1)
End If
On Error Goto 0
To use the id of a user on another domain to map the network drive:
- Scriptname.vbs domain\username password
Cheers
Nigel
Thread
Thread Starter
Forum
Replies
Last Post
gazzawrx
Non Car Related Items For sale
13
17 October 2015 06:51 PM