I have a vbs file that usese a wscript shell to modify registry keys on a
remote machine. It works fine if I have the shell only change one key, but
as soon as I try to change multiple keys in the same shell it simply doesn't
work.
Here's what works:
regforce = "reg add ""\\" & strIP & "\HKLM\SOFTWARE\Microsoft\Windows NT\" &
_
"CurrentVersion\Winlogon"" /v ForceAutoLogon /t REG_SZ /d 1 /f"
objShell.Run regforce,0
Here's what doesn't work:
regboth = "reg add ""\\" & strIP & "\HKLM\SOFTWARE\Microsoft\Windows NT\" &
_
"CurrentVersion\Winlogon"" /v ForceAutoLogon /t REG_SZ /d 1 /f" & _
"reg add ""\\" & strIP & "\HKLM\SOFTWARE\Microsoft\Windows NT\" & _
"CurrentVersion\Winlogon"" /v AutoAdminLogon /t REG_SZ /d 1 /f"
objShell.Run regboth,0
When I try running regboth, neither key gets modified. But if I run either
'reg add' statement by itself it works fine, so the problem seems to be in
the way I'm combining the two statements. I know the '&' character is
supposed to allow multiple commands to be run from a single shell, but it
just isn't working. Anyone know what I'm doing wrong?
Thanks in advance for any help with this...