Link to home
Create AccountLog in
Avatar of tmasters2876
tmasters2876Flag 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!
Avatar of abhilash_m
abhilash_m
Flag of India image

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
Avatar of 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.
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/
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.
I see...  you just need some help creating the VBscript then?
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!
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
ASKER CERTIFIED SOLUTION
Avatar of NJComputerNetworks
NJComputerNetworks
Flag of United States of America image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
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.
Don't have the script together as of yet, but will see about posting it once it is completed.