Visual Basic - VB modificacion de registro

Life is soft - evento anual de software empresarial
 
Vista:

VB modificacion de registro

Publicado por Pavel (1 intervención) el 17/05/2016 16:49:31
Hola,soy principiante en scripting, y como formateo equipos diariamente ,para tener las cosas organizadas y automatizadas,decidí hacer pequeños scripts para facilitar las cosas. Este se supone que es un script para mover la carpeta de usuarios locales a otra partición.


1
2
3
4
5
6
7
8
9
10
11
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "cmd.exe", "/k xcopy C:\Users E:\Users /k/r/i/s/e/c/h/o/b", "", "runas", 1
 
strDefault = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\Default"
strProfilesDirectory = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\ProfilesDirectory"
strPublic = "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList\Public"
Set WshShell = CreateObject("Wscript.Shell")
 
WshShell.RegWrite strDefault,"D:\Users\Default","REG_EXPAND_SZ"
WshShell.RegWrite strProfilesDirectory,"D:\Users","REG_EXPAND_SZ"
WshShell.RegWrite strPublic,"D:\Users\Public","REG_EXPAND_SZ"

me da un error diciendo que la raiz de registro no es valido,pero he comprobado con un RegRead devolviendo el resultado en un MsgBox,y la ruta es correcta,por lo cual no se cual es el error de mi script. Me podéis ayudar por favor?
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder