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.<\/p>\n\n\n\n
The commands listed in this article are specific to triggering tasks upon login. You can accomplish the same goal using command launch events\u00a0Run on Next Login<\/strong>\u00a0or\u00a0Run on Every Login<\/strong>.\u00a0Learn more in\u00a0Get Started: Command<\/a>s.<\/p>\n\n\n\n
Considerations<\/strong>:<\/p>\n\n\n\n
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.<\/p>\n\n\n\n
Execution<\/strong><\/p>\n\n\n\n
In the below example a scheduled task is created called “Test” which will execute “test-script.ps1” upon next login.\u00a0<\/p>\n\n\n\n
$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”<\/code><\/p>\n<\/div><\/div>\n\n\n\n
This can be viewed in the Task Scheduler snap-in alongside all other scheduled tasks.<\/p>\n\n\n\n
\nGet-ScheduledTask<\/code><\/p>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"
Using the Commands feature, IT admins can deploy scripts and commands to further their ability to manage systems in JumpCloud. […]<\/p>\n","protected":false},"author":203,"featured_media":0,"template":"","meta":{"_acf_changed":false,"_oasis_is_in_workflow":0,"_oasis_original":0,"_oasis_task_priority":"","inline_featured_image":false,"footnotes":""},"support_category":[2895,2852,2924],"support_tag":[],"coauthors":[2837],"acf":[],"yoast_head":"\nRun Logon Triggered Tasks on Windows Devices Using Commands - JumpCloud<\/title>\n<meta name=\"description\" content=\"Learn how to use the Commands feature to run logon triggered tasks on Windows devices.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Run Logon Triggered Tasks on Windows Devices Using Commands\" \/>\n<meta property=\"og:description\" content=\"Learn how to use the Commands feature to run logon triggered tasks on Windows devices.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands\" \/>\n<meta property=\"og:site_name\" content=\"JumpCloud\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jumpcloud.com\/\/wp-content\/uploads\/2023\/02\/run-command-as-powershell-1024x627.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n\t<meta name=\"twitter:label2\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data2\" content=\"derekpietras\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands\",\"url\":\"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands\",\"name\":\"Run Logon Triggered Tasks on Windows Devices Using Commands - JumpCloud\",\"isPartOf\":{\"@id\":\"https:\/\/jumpcloud.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands#primaryimage\"},\"image\":{\"@id\":\"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands#primaryimage\"},\"thumbnailUrl\":\"https:\/\/jumpcloud.com\/\/wp-content\/uploads\/2023\/02\/run-command-as-powershell-1024x627.png\",\"datePublished\":\"2023-06-05T17:12:02+00:00\",\"dateModified\":\"2023-06-05T17:12:02+00:00\",\"description\":\"Learn how to use the Commands feature to run logon triggered tasks on Windows devices.\",\"breadcrumb\":{\"@id\":\"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands#primaryimage\",\"url\":\"https:\/\/jumpcloud.com\/\/wp-content\/uploads\/2023\/02\/run-command-as-powershell-1024x627.png\",\"contentUrl\":\"https:\/\/jumpcloud.com\/\/wp-content\/uploads\/2023\/02\/run-command-as-powershell-1024x627.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/jumpcloud.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Support\",\"item\":\"https:\/\/jumpcloud.com\/support\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Run Logon Triggered Tasks on Windows Devices Using Commands\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/jumpcloud.com\/#website\",\"url\":\"https:\/\/jumpcloud.com\/\",\"name\":\"JumpCloud\",\"description\":\"Daily insights on directory services, IAM, LDAP, identity security, SSO, system management (Mac, Windows, Linux), networking, and the cloud.\",\"publisher\":{\"@id\":\"https:\/\/jumpcloud.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/jumpcloud.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/jumpcloud.com\/#organization\",\"name\":\"JumpCloud\",\"url\":\"https:\/\/jumpcloud.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/jumpcloud.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/jumpcloud.com\/wp-content\/uploads\/2021\/01\/jc-logo-brand-2021.png\",\"contentUrl\":\"https:\/\/jumpcloud.com\/wp-content\/uploads\/2021\/01\/jc-logo-brand-2021.png\",\"width\":598,\"height\":101,\"caption\":\"JumpCloud\"},\"image\":{\"@id\":\"https:\/\/jumpcloud.com\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Run Logon Triggered Tasks on Windows Devices Using Commands - JumpCloud","description":"Learn how to use the Commands feature to run logon triggered tasks on Windows devices.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands","og_locale":"en_US","og_type":"article","og_title":"Run Logon Triggered Tasks on Windows Devices Using Commands","og_description":"Learn how to use the Commands feature to run logon triggered tasks on Windows devices.","og_url":"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands","og_site_name":"JumpCloud","og_image":[{"url":"https:\/\/jumpcloud.com\/\/wp-content\/uploads\/2023\/02\/run-command-as-powershell-1024x627.png"}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute","Written by":"derekpietras"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands","url":"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands","name":"Run Logon Triggered Tasks on Windows Devices Using Commands - JumpCloud","isPartOf":{"@id":"https:\/\/jumpcloud.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands#primaryimage"},"image":{"@id":"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands#primaryimage"},"thumbnailUrl":"https:\/\/jumpcloud.com\/\/wp-content\/uploads\/2023\/02\/run-command-as-powershell-1024x627.png","datePublished":"2023-06-05T17:12:02+00:00","dateModified":"2023-06-05T17:12:02+00:00","description":"Learn how to use the Commands feature to run logon triggered tasks on Windows devices.","breadcrumb":{"@id":"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands#primaryimage","url":"https:\/\/jumpcloud.com\/\/wp-content\/uploads\/2023\/02\/run-command-as-powershell-1024x627.png","contentUrl":"https:\/\/jumpcloud.com\/\/wp-content\/uploads\/2023\/02\/run-command-as-powershell-1024x627.png"},{"@type":"BreadcrumbList","@id":"https:\/\/jumpcloud.com\/support\/run-logon-triggered-tasks-on-windows-devices-using-commands#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/jumpcloud.com\/"},{"@type":"ListItem","position":2,"name":"Support","item":"https:\/\/jumpcloud.com\/support"},{"@type":"ListItem","position":3,"name":"Run Logon Triggered Tasks on Windows Devices Using Commands"}]},{"@type":"WebSite","@id":"https:\/\/jumpcloud.com\/#website","url":"https:\/\/jumpcloud.com\/","name":"JumpCloud","description":"Daily insights on directory services, IAM, LDAP, identity security, SSO, system management (Mac, Windows, Linux), networking, and the cloud.","publisher":{"@id":"https:\/\/jumpcloud.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jumpcloud.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/jumpcloud.com\/#organization","name":"JumpCloud","url":"https:\/\/jumpcloud.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jumpcloud.com\/#\/schema\/logo\/image\/","url":"https:\/\/jumpcloud.com\/wp-content\/uploads\/2021\/01\/jc-logo-brand-2021.png","contentUrl":"https:\/\/jumpcloud.com\/wp-content\/uploads\/2021\/01\/jc-logo-brand-2021.png","width":598,"height":101,"caption":"JumpCloud"},"image":{"@id":"https:\/\/jumpcloud.com\/#\/schema\/logo\/image\/"}}]}},"_links":{"self":[{"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/support\/75642"}],"collection":[{"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/support"}],"about":[{"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/types\/support"}],"author":[{"embeddable":true,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/users\/203"}],"version-history":[{"count":3,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/support\/75642\/revisions"}],"predecessor-version":[{"id":80746,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/support\/75642\/revisions\/80746"}],"wp:attachment":[{"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/media?parent=75642"}],"wp:term":[{"taxonomy":"support_category","embeddable":true,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/support_category?post=75642"},{"taxonomy":"support_tag","embeddable":true,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/support_tag?post=75642"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/jumpcloud.com\/wp-json\/wp\/v2\/coauthors?post=75642"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}