Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need script to only run if Reg entry is not present

Status
Not open for further replies.

Ricki

Technical User
Feb 25, 2002
64
GB
Please help with this script

Option Explicit
On error resume next
Dim WshShell
Dim Onet
Set oNet = WScript.CreateObject("WScript.Network")
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegDelete ("HKCU\Software\Microsoft\Office\10.0\Outlook\Setup\First-Run")
WshShell.RegWrite "HKCU\Software\Microsoft\Office\10.0\Outlook\Setup\ImportPRF","\\example\\%username%\outlook.PRF","REG_SZ"
Wshshell.run ("\\example\outlook\lbbd.PRF")
wscript.sleep 10000

Think it might need an if else statments
 
which registry key not being present?
you write and delete 2 different registry entries
 
Hey Movie,

I don't have a problem with the Script above as it works... Its meant to automate Outlook via the PDF file. *Has the stored excahange setting* What I need to do is have the sript to run for people who do not have the *HKCU\Software\Microsoft\Office\10.0\Outlook\Setup\ImportPRF","\\example\\%username%\outlook.PRF","REG_SZ" * key. So in orderwards.... check for this key and If present End else Wshshell.run ("\\example\outlook\lbbd.PRF")
 
Have you tried to play with the RegRead method ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
as PHV suggests
On Error Resume Next
strTemp = WshShell.RegRead("HKCU\Software\Microsoft\Office\10.0\Outlook\Setup\ImportPRF")
On Error Goto 0

If LCase(strTemp) <> LCase(WshSHell.ExpandEnvironmentStrings("\\example\\%username%\outlook.PRF")) Then
'do something

End If


'you need to the On Error stuff due to RegRead having a fit if the key desnt exist, you also might need to play with the %username% stuff as i am not sure what you are doing there as i wasnt aware that RegWrite will implicitly convert environment variables..
'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top