Reputation: 19
Dear readers,
As an IT Trainee I need to write a powershell script for remote starting a scheduled task on a server. I have done lots and lots of research, but I can't seem to find an explanation of the exact thing that I want to do.
What I want is a powershell script that logs me in onto the server, and from there starts the scheduled task with me only filling in my password. This is because logging into the server and starting it from there will take up too much time.
What I have right now is this line of code:
Enter-PSSession -ComputerName ..... -Authentication Kerberos -Credential ..... -EnableNetworkAccess -Port ....
Start-ScheduledTask -Taskpath \\....\..\.....\......\Tasks -Taskname azure ad sync scheduler
I have put dots on some of the more vulnerable places for security reasons, I hope and think that it won't influence any answers
Hopefully someone can help me or redirect me to a good source of information.
Kind regards,
Marc
Upvotes: 0
Views: 3773
Reputation: 39267
Use the following:
Start-ScheduledTask -Taskpath "\\....\..\.....\......\Tasks" -Taskname "azure ad sync scheduler"
Note the double quotes.
Upvotes: 1