Wednesday, January 26, 2011

Fault with my VB script

Hi all,

Im adding a logon script to a GPO to install a program for me. Can anyone see a problem with this script? When the PC boots it comes up saying that it can find the resource?

Const EVENT_SUCCESS = 0

On Error Resume Next

strPlugin = "HKLM\Software\BottomlineTechnologies\TransformInstallationSystem\CurrentInstallPath"
strApp = "cmd /c \\int.company.com\sysvol\int.company.com\scripts\Apps\setup.exe installpath selectall autoexit hide"

Set WSHShell = CreateObject("WScript.Shell")
sReg = WSHShell.RegRead(strPlugin)

If Err.Number <> 0 Then
 Err.Clear
 'Plugin not yet installed
 WSHShell.Run strApp, 0, true
 WSHShell.LogEvent EVENT_SUCCESS, "InstalledPlugin"
Else
 WSHShell.LogEvent EVENT_SUCCESS, "Plugin already installed."
End If


WScript.Quit
  • At first glance: the UNC path needs to start with two backslashes, i.e.:

     strApp = "cmd /c \\int.company.com\sysvol\... 

    It appears that only a single backslash is used above.

    reaction : Yeah that was just me editing the post wrong in here.

0 comments:

Post a Comment