Script help needed with conditionals and Registry key



I need a vbs/wmi or bat script to check to see if the following
registry key is set to U:\%username%
HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell
Folders\Personal

It is set as a REG_EXPAND_SZ entry into the registry

The personal key defines the location of the My Documents folder.

We have a logon script that maps the U:\ drive to the \Users folders
on a file server on the network.
We are wanting to have the My Documents shortcut in the Start Menu in
Windows XP map to the U:\%username% folder
(replace %username% with the person's user name, as everyone that has
a log on has a personal folder on the U:\ drive)

We will include this in the log on script for one month, and since it
is included for one month, we will need to have an if else statement
check to see if it is set to what we need it to be.

If it is set to the U:\%username% then no changes need to be made

If it is NOT set to the U:\%username% then the script needs to do the
following:
1)record in memory the current setting of the Personal registry key
2)copy the data from the current folder to the U:\%username%
3)edit the Personal registry key to point to the U:\%username%
4) delete the old folder.

The reason we are wanting to do this is rather straightforward:
1) we do full network backups and only the documents saved to the file
server are backed up
2) when a computer crashes, we will not have lost any user's
documents, etc.
3) its easier to secure our data on the server than on a multitude of
PCs


I am not sure how to go about doing all this, as I am somewhat new to
registry editng in scripts... Comments/Scripts/Recommendations are
certainly welcome.

Thanks in advance,
Dustin
.



Relevant Pages

  • Re: Script for changing the registry key value
    ... "Jeremy" wrote: ... I am able to add values to the registry key using wshshell.regwrite ... but I want to add the exact expanded value of the folder path to the ... technet script center repositry for the code snippet to create/modify ...
    (microsoft.public.scripting.vbscript)
  • Script to Stop Service
    ... I am looking to create a script that will stop a service ... on the local computer Delete a registry key ... and delete a folder on the local hard drive. ...
    (microsoft.public.windows.server.scripting)
  • Re: How users can clear the OLKEA folder
    ... If you can read the registry key, though, you can determine the folder name. ... I don't know how to read the registry from a script. ... Brian Tillman ...
    (microsoft.public.outlook)
  • Re: User account and Personal folder mismatch script
    ... I believe you want a script that can be run by an administrator that will ... The script above only documents if a home folder has been assigned. ... > End Sub ...
    (microsoft.public.scripting.vbscript)
  • Input on CleanUp script
    ... Since I'm going to be using this script in a production environment, ... If the script is used with a backup folder ... var strTargetFolder, strBackupFolder, args0, args1, args2, noArgs; ...
    (microsoft.public.scripting.wsh)