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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Markdmac Longon script question 1

Status
Not open for further replies.

HessA

MIS
Mar 17, 2005
176
US
I am using virtually everything in your fact. I am mapping drives and printers based on group membership. But I have a few select drives/printers that a single user needs to map. Your faq is mostly about doing it based on the group enumeration. So rahter than this:

'Case "WorkerB"
'WSHNetwork.MapNetworkDrive "w:", "\\Server\Shared Documents",True

What would I change to add the single user mappings I need into the one global script I am making.

I'm in a Windows 2003 Domain. and I basically want to say

Case username
WSHNetwork.AddWindowsPrinterConnection"\\nav-gtwy-dc\SalFrontCopy"

Any help is greatly appreciated,

Aaron
 
I would think that modifying the script to suit specific users is not very efficient.
 
It's not to suit specific users. All the users are done by group membership for printer mapping and drive mapping. But I have a couple individuals that get a single printer nobody else in the company gets. Or a user that maps a drive to a server that nobody else in the company gets. All total it's 3 maybe 4 instances where I need something mapped individually. The script I am using starts by wiping all network drives and printers then remaps only the drives printers I give them. Which works great. But say I have a user where I individually manually map a drive on he will lose that drive at login and it won't be remapped via the script.

Thanks,

Aaron
 
Hi Aaron,

You can do exactly what you are asking. Simply do a new select statement. We are alredy grabbing the User Name as UserString, so:

Select Case UserString
Case Aaron
blah blah
End Select


OK, that all said I too would discourage doing this and instead would make that user a member of a new group to execute the code you want using the group checking. It won't negate what you have already done and will make the script a little easier to follow when editing.

Either way you look at it it can be done however.

I hope you find this post helpful.

Regards,

Mark
 
After some thought I figure I will add a couple group for these users to accomplish it without doing it individually (although your response is still great if I ever decide I need to do something by user rather than group so I thank you none the less). I do however have a more pressing issue I have multiple servers with home directories (different file servers and geographic locations). As you can see below I have at the moment a static mapping for H: based on the username of the person logging in which works fine in ONE of my locations. Can I enumerate OU membership and do a type of IF THEN statement to decide which server the home directory so be mapped to? Here is what I have for H: now which is static save for the username which is = to the share name.

WSHNetwork.MapNetworkDrive "H:", "\\salinesnap1-new\" & UserString,True


Thanks in advance,

Aaron
 
Rather than doing that, I would suggest that you take a look at DFS. Using DFS you could have the same location for everyone while the files themselves could exist at multiple servers.

I hope you find this post helpful.

Regards,

Mark
 
PS: I'll be happy to help you with DFS if you need it but we should move that discussion to either the Windows 2000 or Windows 2003 forum.

I hope you find this post helpful.

Regards,

Mark
 
OK this will be a very noob question. What does DFS stand for Distributed File System? So I can look it up properly and read up.

Thanks again,

Aaron
 
Thanks Mark if I have a specific question after reading up I will post it in The Windows 2003 forum.

Aaron
 
I'll watch for it there. Good luck.

I hope you find this post helpful.

Regards,

Mark
 
As easy as it was to setup and understand I can't believe we weren't using it sooner.

Thanks,

Aaron
 
Ah, so we have a DFS convert then do we? Glad you found it useful. It is a great tool for companies with a few servers or lots of users etc.

[2thumbsup]

I hope you find this post helpful.

Regards,

Mark
 
Hi
I’m trying to write a small utility that allows people to map to a remote drive without making the connection persistent.
So I use the code below in a window form
Dim WshNetwork As Object
WshNetwork = CreateObject("WScript.Network")
WshNetwork.MapNetworkDrive("E:", "\\SomeServer\SomeShare", , txtUsername.Text.ToString, txtPassword.Text.ToString)

the problem is the MapNetWorkDrive does not care what password I supply , I could type "mypassword" or "hello" and it will still work as long my txtUsername =domain\ntAccount.

then this is the kicker if I want to log in to a certain share as a different user/ password (given userid & password are valid)I get the dreadful error "Multiple connections to a server or shared resource by the same user, using more than one user name, are not allowed. Disconnect all previous connections to the server or shared resource and try again.."

Any thought any suggestions
Regards
 
First off try this:

WshNetwork.MapNetworkDrive("E:", "\\SomeServer\SomeShare", False, txtUsername.Text.ToString, txtPassword.Text.ToString)

I believe however that the user ID and password are ignored if the local account can authenticate to the resource which is why the password you are typing does not matter.

Regarding your error, it is rather annoying but simple to understand. You can not have multiple connections to a server with different credentials since once you are logged on you don't get prompted each time you try to open another resource. So, you will need to disconnect any open connections to the server first to change credentials.


I hope you find this post helpful.

Regards,

Mark
 
Mark thanks for the reply, but I tried
WshNetwork.MapNetworkDrive("E:", "\\SomeServer\SomeShare", Ttrue, txtUsername.Text.ToString, txtPassword.Text.ToString)

as well
WshNetwork.MapNetworkDrive("E:", "\\SomeServer\SomeShare", False, txtUsername.Text.ToString, txtPassword.Text.ToString)

Same result, still ignors the PASSWORD.

And as for the message it does not appear when you use Window explorer/Tools/Map Network drive.../Connect using a different user name.
And this nis what I am trying to achieve programaticaly, when using explorer you do not have to disconnect all other network if you have a drive using other user credential.
If you have any ideaq that whould be great.
Thanks in advance.
 
Can you help me understand why this is necessary for your environment? Why are your users not synchronized with the same user ID and password between your servers?

I hope you find this post helpful.

Regards,

Mark
 
the reason I needed this approach is that the administrator log on to their machine using a regular NTFS login user id but when they need to go to servers that they are the only one allowed to go to, they have to log on as a secondary ID to these servers, the secondary IDs are used only for this purposes,
But as I said at the beginning I needED this approach earlier, I change it to have a file with all the links (\\servers\shares) and the users are not logged on to any of the shares at any time if they need access they select the drive from a dropdown list that reads the file and logged to the server.

In a nut shell, thanks for your help I truly appreciate it and there is no way I can do what I needed to do not to a programming deficiency but to the way MS do their security, to be able to log on to a server with a different credential you have to have no drives mapped to ANY shares on this server (it is at the server level not the share level)

Again thanks for all your help.
 
How about using Terminal Services in Admin mode? That would allow your Admins to log in with their elevated permissions, access any files they need and if they need to copy soemthing locally they can do that too using the RDP5 client if they have enabled local disk access.

I hope you find this post helpful.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top