Notices
Computer & Technology Related Post here for help and discussion of computing and related technology. Internet, TVs, phones, consoles, computers, tablets and any other gadgets.

vbs script to connect/map drive ...

Thread Tools
 
Search this Thread
 
Old 02 January 2003, 11:27 AM
  #1  
Sheepsplitter
Scooby Regular
Thread Starter
 
Sheepsplitter's Avatar
 
Join Date: Nov 2001
Posts: 1,072
Likes: 0
Received 0 Likes on 0 Posts
Post

Can't you just use:-

net share sharename=\\myserver\directory


and use trusts, or something like that?


[Edited by Sheepsplitter - 2/1/2003 11:33:39 AM]
Old 02 January 2003, 09:26 PM
  #2  
snowcrash
Scooby Regular
 
snowcrash's Avatar
 
Join Date: Mar 2002
Location: www.scoobyzone.co.uk
Posts: 2,082
Likes: 0
Received 0 Likes on 0 Posts
Post

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]
Old 01 February 2003, 09:06 AM
  #3  
snowcrash
Scooby Regular
 
snowcrash's Avatar
 
Join Date: Mar 2002
Location: www.scoobyzone.co.uk
Posts: 2,082
Likes: 0
Received 0 Likes on 0 Posts
Post

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
Old 01 February 2003, 11:42 AM
  #4  
nigelward
Scooby Regular
 
nigelward's Avatar
 
Join Date: Oct 2001
Posts: 831
Likes: 0
Received 0 Likes on 0 Posts
Thumbs up

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
Old 01 February 2003, 11:45 AM
  #5  
nigelward
Scooby Regular
 
nigelward's Avatar
 
Join Date: Oct 2001
Posts: 831
Likes: 0
Received 0 Likes on 0 Posts
Post

I think that you could also do:

NET USE i: \\servername\sharename password /user:domain\username
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
KAS35RSTI
Subaru
27
04 November 2021 07:12 PM
gazzawrx
Non Car Related Items For sale
13
17 October 2015 06:51 PM
Ganz1983
Subaru
5
02 October 2015 09:22 AM
crazyspeedfreakz
ScoobyNet General
5
29 September 2015 05:04 PM
Littleted
Computer & Technology Related
0
25 September 2015 08:44 AM



Quick Reply: vbs script to connect/map drive ...



All times are GMT +1. The time now is 07:36 AM.