Jump to content
Sign in to follow this  

Script Flow Process

Recommended Posts


Want to see if anyone has a better, cleaner way to do this. Currently I have 2 AutoIt Scripts (both will be compiled with the second script included in the compiled version of the first as a fileinstall). I will be running the 1st script via PSExec against either a remote server or workstation (and copying the script to the device so it exist locally). The initial script starts the schedule service on the target device and then sets an AT job for 11:00pm to run the second file (which is copied to the Windows folder as part of the fileinst). The second file basically checks to see if the device is a workstation or server, if workstation it forces a reboot, if server then if first shuts down a specific service before forcing a reboot.

What I would like to do is use just one single file (without a fileinstall) however I can't think how I could run the file a second time (actually at 11:00pm) without the script trying to start the schedule service again and setting another AT job... Here is the code I have so far:

First file (which includes the second file for the actual shutdown)

If (@OSType <> "Win32_NT") Then
FileInstall ( 'SchShut.exe', @WindowsDir & '\SchShut.exe', 1 )
RunWait ( @Comspec & ' /C Net Start schedule' )
RunWait ( @Comspec & ' /C AT 23:00 ' & @WindowsDir & '\SchShut.exe' )

Second file (SchShut.exe)

$OSRole = RegRead ( 'HKEY_LOCAL_MACHINE\' & 'System\CurrentControlSet\Control\ProductOptions', 'ProductType' )
    If $OSRole = 'WinNT' Then
    Wkstn ( )
    ElseIf $OSRole = 'Server' Then
    Server ( )
Func Wkstn ( )
    Shutdown(6) ;Force a reboot

Func Server ( )
    RunWait ( @Comspec & ' /C Net Stop "FEDPOSIF 4680 POS INTERFACE"' )
    Shutdown(6) ;Force a reboot

Anyway to combine the 2 into one single file without a fileinstall, yet insure that the second time the file is ran (actually by the device at 11:00pm) it does not try to execute the code within the first script? Hope this makes sense...



Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...