Start a conversation

Launching STAR*NET using a Windows scheduled task

STAR*NET Ultimate can be launched to perform a specific adjustment using Windows task scheduler.  

This can be valuable for a number of reasons:

  • A STAR*NET adjustment can be configured so that it runs as a regularly scheduled task at a set schedule
  • It may be necessary to run STAR*NET in a specific user account.  Using Windows task scheduler and a batch file allows this configuration.

See below a guide showing how to run the example project found in:     .\Documents\MicroSurvey\StarNet\ExamplesTutorial01-Trav2D.snproj using the Auto Adjust option:

  • We've added an additional step that allows you to trigger the scheduled task using a batch file.

Step 1: Create the Scheduled Task

Hit the Windows key and type Task Scheduler and click on the icon that appears in the search results:

Right click on "Task Scheduler Library" and select Create Task (not "Create Basic Task")

Now you will see a series of tabs:

On the General tab:


Name: STARNET_Adjustment

Description: Runs STAR*NET adjustment

Security Options: If you require STAR*NET to run in a specific account:

  1. Select "Object Types..." and select only User
  2. Enter email that the user is associated with
  3. Select "Check names"
  4. If a match was found, the identity will be displayed underlined:

Select Run whether user is logged on or not

NOTE: STAR*NET must have been run once in the User account being assigned and license credentials manually entered for automated adjustments to take place

NOTE: This is important when you need STAR*NET to run in a separate user account.  Permissions may need to be adjusted.

Check Run with highest privileges if needed.

Click OK.

NOTE: You will be prompted for account credentials for the chosen User or User Group if you have selected a specific account and have not selected the "Do not store password" option.  If you see an error message, permissions may need to be adjusted.


Step 2: Add a Dummy Trigger

Task Scheduler generally requires at least one trigger.

Select Triggers tab

Click New

Set:

Begin the task: On a schedule

NOTE: In this example we're going to use a batch file to trigger the task, but if you wish you can set a schedule for running the task and skip to Step 3 in this guide:

Select: One-time 

Set a date far in the future (for example January 1, 2099)

Enabled: Yes

NOTE: The task will likely never naturally run, but it can be started manually or by a console command or script

OK


Step 3: Configure the Action

Select the Actions tab

Click New.

Set:

Action: Start a Program

Program/script: C:\Program Files\MicroSurvey\StarNet XX\StarNet.exe 

...(where XX = Version)

Add arguments: "Tutorial01-Trav2D.snproj" /AUTOADJUST 3 1 15

Start in: (RequiredC:\Users\<Your login>\OneDrive - Hexagon\Documents\MicroSurvey\StarNet\Examples


Step 4: Modify Settings

Select the Settings tab

Select: "Allow task to be run on demand"

Select: "Run task as soon as possible after a scheduled start is missed"

Select the option for "If the task is already running, then the following rule applies:"

Do not start a new instance


Step 5: Test the Task

In Task Scheduler:

Right-click the task.

Select Run.

Verify that STAR*NET launches and performs the adjustment by either of these two methods:

  1. enter "Ctrl + Shift + Esc" and check that STAR*NET appears in the "Background processes" section of task manager
  2. verify that the timestamps of the .lst and .run files updates about 2 minutes after triggering the task

NOTE: allow 1 minute for updates


Ways to trigger the Adjustment:

Windows Scheduled Tasks:

If you have set a schedule for the scheduled task it will launch a STARNET adjustment following the required schedule.  This should work even when the user is logged out.  Verify this is working by checking:

Log out of the account before a scheduled launch

Stay out of the account until a minute after the scheduled time

Log back in and verify that the timestamps of the .lst and .run files have updated about 2 minutes after triggering the task


Command Line:

Open the command line by windows the windows key and typing CMD

Open the Command Prompt

Enter command: schtasks /run /tn "STARNET_Adjustment"

Verify this is working by checking:

  1. right click on the Windows taskbar, select "Task manager" and check that STAR*NET appears in the "Background processes" section of task manager
  2. verify that the timestamps of the .lst and .run files updates about 2 minutes after triggering the task


Triggering the Scheduled task using a batch file:

Create a new text document

Name it "Test Scheduled task.bat"

Include the following instructions in the batch file:

@echo off

schtasks /run /tn "STARNET_Adjustment"


Save the text file.  Double click to run the batch file and verify that the adjustment is run by:

  1. enter "Ctrl + Shift + Esc" and check that STAR*NET appears in the "Background processes" section of task manager
  2. verify that the timestamps of the .lst and .run files updates about 2 minutes after triggering the task


Choose files or drag and drop files
Was this article helpful?
Yes
No
  1. FULTON Kiera

  2. Posted
  3. Updated

Comments