"Al Dunbar" <> wrote in message
news:%23mW$...
>
> "Pegasus (MVP)" <> wrote in message
> news:%...
>>
>> "Phil McNeill" <> wrote in
>> message news:%...
>>> Any suggestions on how I could script changing persistent drive mappings
>>> on several hundred user profiles to change the server name they point
>>> to?
>>> We're migrating shares from one server to another (a new DFS namespace
>>> actually), and we have a lot of users who have manually mapped drives
>>> for
>>> themselves (on top of the ones we map for them with their login
>>> scripts).
>>>
>>> I need a way to parse the Windows registry and grab all the values for
>>> each drive mapping's "RemotePath" value in HKEY_CURRENT_USER\Network,
>>> unmap anything that points to the old server (e.g. "net use g: /d") and
>>> then remap that same driveletter to the same sharename with a new
>>> servername.
>>>
>>> Too much to ask?
>>>
>>> Thanks for any tips.
>>>
>>> Windows Server 2003 domain with a mix of XP and W2K clients.
>>
>> Having persistent drive mappings in a domain environment is not
>> a good idea, as you see yourself right now. This would be a good
>> time to put your drive mappings into a centralised netlogon file. At
>> the same time you should turn off persisten connections.
>
> It seems to me that he is mapping non-persistently in his logon scripts,
> and
> that part of the change to a new server will be trivial.
>
> The persistent drive mapping seems to be something that the users are
> doing
> for themselves. Given that this "is not a good idea in a domain
> environment", the way *I* would approach this (or the way I would *like*
> to)
> is to say that, since the users created their non-standard mappings, they
> are self-supporting, and quite capable of accommodating the change however
> they see fit.
>
> When we provide shares for some individuals that appear nowhere in the
> standard mappings, I try to avoid encouraging them to map to them, but
> show
> them how to create a shortcut. And if they keep them in a folder on their
> home folder, the same shortcuts will be available everywhere they logon. I
> also provide a folder full of the more widely used shortcuts on a standard
> share and update them myself when things change.
>
> /Al
>
>
Hi guys,
Definitely something that our users are doing themselves, and we DO
discourage it, but some of them do it nonetheless (about 150 of them out of
700 based on some info we've gathered). I do not have the option to tell
them "you brought this on yourself, so too bad for you". Wish I did.
As far as the script goes, I found something online describing the EXACT
problem I'm having (it has to do with the implementation of a DFS
consolidated root and what that does to EXISTING persistent drive mappings).
Turns out I don't need to remap to the new location at all (although that
would be a "nice to have"). After the activation of the consolidated root,
it will be good enough to unmap the persistent drive mappings, and remap
them back to exactly where they pointed to previously. The consolidated
root problem only affects drives mapped BEFORE it was implemented (more info
for anyone interested as to why:
http://www.tech-archive.net/Archive/...4-08/0711.html
The script I found to do this is as follows:
Set objNetwork = WScript.CreateObject("WScript.Network")
Set colDrives = objNetwork.EnumNetworkDrives
For i = 0 to colDrives.Count-1 Step 2
Wscript.Echo colDrives.Item(i) & colDrives.Item (i + 1)
objNetwork.RemoveNetworkDrive colDrives.Item(i)
Wscript.Echo "Check to see if " &colDrives.Item(i) &" is now unavailable"
objNetwork.MapNetworkDrive colDrives.Item(i),colDrives.Item (i + 1)
Wscript.Echo colDrives.Item(i) & " remapped to " & colDrives.Item (i+1)
Next
I've tested calling this at the bottom of our existing logon scripts, and it
works fine, except for a few things that I'm hoping you can help with.
1. I NEED it to be non-interactive/quiet. Right now it prompts the user 3
times for EACH drive mapping.
2. I NEED it to ignore the H: drive. Right now it coughs on the H: drive
(standard drive mapping for home directories), presumably because we have a
single share for home directories, and each user maps to their specific
folder WITHIN that share that only they have access to. Windows sees that
connection below the share level as an open file, and this script can't kill
that to unmap and re-map the drive, so it quits with an error.
It would still be NICE if we could remap to the new location, but if I can
take care of those two NEEDS above, that'd be sufficient to allow us to
implement the consolidated root without killing all these manually mapped
drives.
Any help greatly appreciated!
Thanks,
Phil