First of all: You are about to read a really stupid question now. I am a beginner in VBS, so please forgive me ;-)
What I want to do with my script:
Check in registry, if Visio is installed
If yes: Change the key to the stated visio key
I want to run this script in a group policy (machine) which is run on startup.
What is not working?
The script returns always 'not existent' even if the key exists
If I run only the ospp.vbs part of the script (which should write the Visio key), it doesnt change anything.
It doesn't matter, if I run this script over GPO or directly as administrator on the client. Sooooo... here's the script:
Thank you very much for your help!
Cheers, Simon
What I want to do with my script:
Check in registry, if Visio is installed
If yes: Change the key to the stated visio key
I want to run this script in a group policy (machine) which is run on startup.
What is not working?
The script returns always 'not existent' even if the key exists
If I run only the ospp.vbs part of the script (which should write the Visio key), it doesnt change anything.
It doesn't matter, if I run this script over GPO or directly as administrator on the client. Sooooo... here's the script:
Code:
Option explicit
Dim sKey, bFound, objShell
skey = "HKEY_LOCAL_MACHINE\SOFTWARE\VAL_3.7\MSVisioProf2010_ENG"
with CreateObject("WScript.Shell")
On error resume next
sValue = .regread(sKey) ' read attempt
bFound = (err.number = 0) ' test for success
on error goto 0 ' restore error trapping
end with
if bFound then
wsh.echo "Found:", sValue
Set objShell = WScript.CreateObject ("WScript.shell")
objShell.run "cscript " & Chr(34) & "C:\Program Files (x86)\Microsoft Office\Office14\OSPP.vbs" & Chr(34) & "/inpkey:7MCW8-VRQVK-G677T-PDJCM-Q8TCP"
else
wsh.echo "Not found"
end if
Set objShell = Nothing
Thank you very much for your help!
Cheers, Simon