Nice rundll32 use!

--
ME2


On Fri, Jun 5, 2009 at 5:51 PM, Mike Wiebke <[email protected]> wrote:

>
> The trick is that you need to tell explorer to reread the registry
> settings.  Here is a snippet from a vbscript that will redirect the My
> Documents to a network drive after the user is logged in.  Watch out for the
> wrapping.  The trick is the rundll command that forces explorer to reread
> the user portion of the registry.  You should be able to modify this to work
> with your batch file.
>
>
> Option Explicit
>
> Dim oNet, oShell
>
> Set oNet = CreateObject("Wscript.Network")
> Set oShell = CreateObject("WScript.Shell")
>
> oNet.MapNetworkDrive "U:", "\\server\HomeFolders\" & oNet.UserName, True
>
> oShell.RegWrite
> "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell
> Folders\Personal", "U:\My Documents", "REG_SZ"
> oShell.RegWrite
> "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell
> Folders\Personal", "U:\My Documents", "REG_SZ"
>
> oShell.Run oShell.ExpandEnvironmentStrings("%windir%\system32\rundll32.exe
> user32, UpdatePerUserSystemParameters ,1 ,True")
>
>
> Mike Wiebke
> Rapid Fire Solutions
>
>
>
> ----- Original Message ----
> From: IS Technical <[email protected]>
> To: NT System Admin Issues <[email protected]>
> Sent: Friday, June 5, 2009 3:05:05 PM
> Subject: Changing MY DOSS location using script or batch file after log in
>
> Anyone know if it possible to change the location of MY DOCUMENTS
> on-the-fly
> after a user logs in using a batch file or script?
>
> This is for a Windows XP Pro machine running on a network with no DC.
>
> I've tried importing the relevant reg keys from a script but this doesn't
> seem to work.
>
> Thanks..
>
>
> Regards,
> Charles
>
> ---
>                       Charles Figueiredo PhD
>       Integrated Solutions - Enhancing Small Business Systems
> ---
>
>
>
>  ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
> ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>
>
>
>
>
> ~ Finally, powerful endpoint security that ISN'T a resource hog! ~
> ~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~
>

~ Finally, powerful endpoint security that ISN'T a resource hog! ~
~ <http://www.sunbeltsoftware.com/Business/VIPRE-Enterprise/>  ~

Reply via email to