Last active
May 7, 2023 02:44
-
-
Save imoutsatsos/068e8e8e509e0a74dc6a1073760293c5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# As generated by ChatGPT-Does NOT work | |
# there is no 'User' option but can try 'Principal' | |
# Define the path to the Java executable and the arguments to pass to it | |
$javaPath = "C:\Program Files\Java\jre1.8.0_281\bin\java.exe" | |
$javaArgs = "-Dcantaloupe.config=cantaloupe.properties -Xmx2g -jar cantaloupe-5.0.5.war" | |
# Define the name of the scheduled task and the user account to run it as | |
$taskName = "Cantaloupe" | |
$taskUser = "DOMAIN\USERNAME" | |
# Create a new scheduled task that runs on startup | |
$action = New-ScheduledTaskAction -Execute $javaPath -Argument $javaArgs | |
$trigger = New-ScheduledTaskTrigger -AtStartup | |
$task = New-ScheduledTask -Action $action -Trigger $trigger -User $taskUser -TaskName $taskName | |
# Register the task with Windows Task Scheduler | |
Register-ScheduledTask -InputObject $task |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment