I think you're basically there; the only thing I can see wrong is you're testing "myvariable" but you're not giving it a value. You're also testing for 12.0 (etc); it's safer to test for something like that as a string (ie "12.0") - in maths, 12 is the same as 12.0; in this situation it might not be :-)
I think this should work:
Code:
set oShell = createobject("wscript.shell")
Set oExcel = CreateObject("Excel.Application")ll
iVer= oExcel.Version
oExcel.Quit
sCmd="regedit /s \\mydomainname\netlogon\outlook\" & iVer & ".reg"
oShell.run,,true I've used Excel instead of Word because I can't get a Word object here (could be because I've got Office 2010 installed) - I'm sure you should be able to use Word.
I then just take the version number and store it in a variable - this is the key step you missed.
I then simplify the rest of your code - there's nothing wrong with what you've done; I'm just saving ink :-)
You're trying to use the name of the logon server; your code is wrong (example of what you can do below) but you don't need it - if your domain is called "school" then \\school\netlogon will take you to the netlogon share on a DC.
The next bit of my line just saves on an IF statement; you've made a folder called "11.0" or "12.0" so you can just take advantage of that in building the command.
Finally, I've marginally shortened the run command - yours is exactly right but you can just put "true" at the point it's needed and the ",," construct implies a zero (you could actually just do oShell.run sCmd; the 0 bit just says "run command in normal window" and the true bit says "wait for this to finish" - the regedit will be so quick you can do without both!)
Hope that helps.
If you want to specify the name of the domain controller then you've either got to extract it from the environment variable in vbscript or let the command shell expand it. Either of these would work:
Code:
logondc=oShell.ExpandEnvironmentStrings("%logonserver%")
sCmd=sCmd="regedit /s " & logondc & "\netlogon\outlook\" & iVer & ".reg" Code:
sCmd="regedit /s %logonserver%\netlogon\outlook\" & iVer & ".reg"