Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

VB Login Script Change drive Mapping

Posted on 2006-07-21
4
771 Views
Last Modified: 2008-02-01
Let me start out by saying I'm very weak in vbscripting. Ok, here is what I need to do. I need a login script that will edit the following registry key: HKEY_Current_User\Network. I'm in the process of migrating from one file server to another and a lot of my users have manual drive mapping. I need to script to detect the old server name and replace it with the new server name while keeping the same drive letter. So it's transparent to the user. Thanks in advance.
0
Comment
Question by:compdigit44
  • 2
  • 2
4 Comments
 
LVL 4

Assisted Solution

by:JRCSystems
JRCSystems earned 385 total points
ID: 17159590
I am not sure of a few things here.

1. Why does it have to be a script, as opposed to a VB program?
2. What OS(es) are you running? All the same? mixed?

Here's the reason(s) I ask:

I believe starting with Win 2K (not sure about 98), administrators could connect to remote registries.

VB, has that same ability to OPEN / EDIT a registry on a remote computer (providing OS allows it).

I am not sure of the specifics of your office, but it seems you'd have to loop through HKEY_USERS on the machine,
assuming there's more than 1 user account with the redirect/drive mapping.

You weren't specific on the drive letter, or the old server name, new server name, but in general, you have something that did this:

Read registry key(s)
HKEY_USERS\[user guid WITHOUT _classes]\Network\[Drive Letter]
Edit "RemotePath" = \\[newservername]\[sharename]

Again, depending on the OSes there, VB could even loop through all computers on the network, connect to each registry, edit/save, continue.

It would avoid the login script scenario.

-----------

Then again, there is 1 solution that doesn't involve any programming:
rename the "oldserver" to olderServer2"
rename the "newserver" to "oldserver"
have everyone reboot. no programming changes, everyone is pointing to the new server.


Hope that helps.



0
 
LVL 19

Author Comment

by:compdigit44
ID: 17160829
Sorry for the lack of information. I have 95 desktops, 80 are running Windows XP professional 15 are still running Windows 2000 professional. I still have a NT 4.0 domain, which I'm currently in the process of migrating. So connecting to each of these desktop wouldn't be very efficient. Renaming the servers would be great but isn't an option for me either. Is there some way in the VB script you can tell it to look at the remote path in the registry and use an 'if' statement? So if old_server_name is present change to new_server_name????
0
 
LVL 4

Accepted Solution

by:
JRCSystems earned 385 total points
ID: 17162983
Yes, there is a way to read the remote registry, check its value, and change it.

I have got a Class file I could send you that you'd need to implement in your program.
The module is about 800 lines of code. It did not seem right to post that as the answer, with no explanation.
I've used this class library for about the last 4 years. It original came from VB2theMax, and got various updates.


Inside the class, there are 2 key methods:
ReadRemoteRegistryValue and WriteRemoteRegistryValue.

Those methods, tied to your "IF" statement checking the server name, will solve the problem.





0
 
LVL 19

Author Comment

by:compdigit44
ID: 17163769
Thanks the the feed back everyone. In my efforts of having a low impact on the end users enviroment may quest for a script to move user from one server to another have become very complex. I have to admit some of the VB replys are way beyond my VB script knownledge. I'm most likely going to send out a batch script that will disconnect everyones mapped drive then reconnect them to a different drive letter. This way everyone will have uniform network drive mappings.
 
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
how to open Waze.com/livemap from address saved in DB? 26 211
Put text in a picture ASP.NET C# 2 61
Run code from text file in vb 1 73
Set email body to html using vbscript 6 49
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question