set wshShell= Wscript.CreateObject("WScript.Shell")
wshshell.Run "regedit /s
\\servername\scripts\outlook\outlook.reg",0,bWaitOnReturn
What I want to be able to achieve is find the Logon DC and use that as the
location to run the .reg file from.
I have the below which succesfully gets the Logon DC for me:
Set WshShell = WScript.CreateObject("WScript.Shell")
LogonDC= WshShell.ExpandEnvironmentStrings("%logonserver%")
wscript.echo LogonDC
which outputs to \\servername
but I can't seem to be able to get the LogonDC variable to work in the
regedit command. I think I may just be missing the syntax for how to provide
it; I am trying along the lines of:
Set WshShell = WScript.CreateObject("WScript.Shell")
LogonDC= WshShell.ExpandEnvironmentStrings("%logonserver%")
set wshShell= Wscript.CreateObject("WScript.Shell")
wshshell.Run "regedit /s logondc\scripts\outlook\outlook.reg",0,bWaitOnReturn
Any help much appreciated!
The run method needs a string, so you need to construct that string
from the contents of your variable using concatenation ...
' ...
bWaitOnReturn = True
wshshell.Run "regedit /s " & logonDC & "\scripts\outlook
\outlook.reg", _
0,bWaitOnReturn
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
I had the
& logonDC &
earlier, but was missing the extra quotes.
Thanks a lot!