Jump to content

Script sometimes fails from Startup folder


Recommended Posts

I have a script that runs from a shortcut in the Startup folder. The script is locating in C:\Program Files\Diagnostics

The machine is locked down, and the script runs a diagnostic program as the system administrator at machine boot.

Usually, but not always, the script reports that is already running. I have checked that the script is only running from one place - IE only launched a single time. If I bring the PC back here, it works every time!?!

If the script fails, logging off and back on as the same user makes the script always work.

This is the script:

RunAsSet("Administrator", @Computername, "password")

$User = StringUpper(@UserName)

$Serv_Launch_Addr = IniRead("Diags.ini", "main", "ServerLaunchAddress", "https://xxx.com")

$Serv_Kiosk_Mode = IniRead("Diags.ini", "main", "ServerLaunchKiosk", "1")

$IExplore = IniRead("Diags.ini", "main", "IExplore", "IExplore")

RunWait("C:\Program Files\Diagnostics\Diags.exe", "C:\Program Files\Diagnostics", @SW_MAXIMIZE )

if $Serv_Kiosk_Mode = "1" Then

$cmdline = $IExplore & " -k " & $Serv_Launch_Addr

Else

$cmdline = $IExplore & " " & $Serv_Launch_Addr

EndIf

;MsgBox(0,"", "cmdline=" & $cmdline)

RunWait( $cmdline, "", @SW_MAXIMIZE )

;MsgBox(0,"", "After Launch RunWait" & $cmdline)

If $User = "OPERATOR" Then

Shutdown(1)

EndIf

; Reset user's permissions

RunAsSet()

Edited by dcallaghan
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...