Using the Commands feature, IT admins can deploy scripts and commands to further their ability to manage systems in JumpCloud. Working with a varied audience of users and environments, we have collaborated to create some "policy" commands for purposes ranging from security to software management.
The commands listed in this article are specific to triggering tasks upon login. You can accomplish the same goal using command launch events Run on Next Login or Run on Every Login. Learn more in Get Started: Commands.
- Windows 8, Windows Server 2012 or newer is required.
- Scheduled tasks created in this manner will run as the same user that created them.
When configuring Windows commands, you can specify if you would like to run the command execution via PowerShell or CMD. The Logon triggered task must be executed using Windows PowerShell.
- Select Windows Powershell to run via PowerShell
In the below example a scheduled task is created called "Test" which will execute "test-script.ps1" upon next login.
$action = New-ScheduledTaskAction -Execute C:\test-script.ps1
$trigger = New-ScheduledTaskTrigger -AtLogOn
Register-ScheduledTask -Action$action -Trigger $trigger -TaskName "Test" -Description "Testing Scheduled Task API via PowerShell"
This can be viewed in the Task Scheduler snap-in alongside all other scheduled tasks.