Avatar of tmasters2876
tmasters2876
Flag for United States of America asked on

Login Script - Redirect MyDocuments to new server

We moved to a new server and am looking for a script to first see if the user has mydocuments redirected and if so change the server name to the new one.  I don't want to make change for evryone since not everyone redirects to the server.  This is also why GPO will not work.  Thanks!
Windows Server 2003Windows Server 2008VB Script

Avatar of undefined
Last Comment
tmasters2876

8/22/2022 - Mon
abhilash_m

abhilash_m

Add those users to a new group and apply gp for that group wohever need my docs folder redirection.

For mapping use the below command
net use x: " \\server\share\%username%\My Documents" /persistent:no
tmasters2876

ASKER
Thanks for the answers, but GPO will not be a viable solution as the number of users is in a mix of 6000 individuals, some having the redirect and some not.  The link given above did not give me an answer as it is geared more towards GPO than vbscript.  I've done this many times in many organizations via GPO, but this time a script is necessary for the conditional nature.  I also know how to do a straight script for new users, or to make it a standard, but as I.T. professionals I have to work around what management dictates.

So what I really need is assistance in making the condition to look in the registry to see if they have a redirect to the server, then change that servername to the new one and move forward.  The folder structure is already migrated over, just need to get the users to map correctly.
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck
NJComputerNetworks

seems like even if you did create a script to detect and change mydoc redirection, the GPO would "fight" against the vbscript setting.   It doesn't seem wise to try to control the same registry setting in both GPO and Vbscript at the same time.

In any case, creating a vbscript is possible if you know what setting you want to look for and change.  The Microsoft script repository might be a good starting point to see some examples:  http://gallery.technet.microsoft.com/ScriptCenter/en-us/
NJComputerNetworks

tmasters2876

ASKER
We are not actually using GPO for folder direction AND vbscript.  I was merely pointing out that I have used GPO's in past organizations, but it does not apply here.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
NJComputerNetworks

I see...  you just need some help creating the VBscript then?
tmasters2876

ASKER
Yes.  I know the key to check for is HKCU\Software\Microsoft\Windows]CurrentVersion\Explorer\Shell Folders and then the REG_SZ key Personal, I just am having a hard time figuring out how to pull this information, compare it and if the value contains \\servername01 then change it to \\servername01 else end statement, or case else exit or something.

I had the hardest time figuring out how to explain that when I submitted the question to begin with, but am glad you are picking up on it and not confused my my own confusion.

Thanks!
NJComputerNetworks

I think this is a nice example on how to look at a registry key and then (If then) do something with the registry key.  In this example, they are modifying the registry that pertains to SNMP.

http://gallery.technet.microsoft.com/ScriptCenter/en-us/bacf8f0a-56fd-47ed-b443-7d7d7a9f9192
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
NJComputerNetworks

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
tmasters2876

ASKER
Thanks NJ.  I'll take a look.  I think this will help quite a bit.  Will post the script if I figure out the resolution on this.  But you'll get the points now regardless.  You've helped very much.
tmasters2876

ASKER
Don't have the script together as of yet, but will see about posting it once it is completed.