Powershell script to schedule daily task error


I have a very simple power shell script that will register console applications as daily scheduled tasks.

The application reads the file path from user input and attempts to register the application as a task using a specific user account. I can get the script working by using

However when I try to use the above script I get this error:

Register-ScheduledTask: No mapping between account names and security IDs was done.

I have ensured that the account exists as it is currently running several services. I am also new to powershell so have tried adding quotations around the username with no luck.


Don’t think PowerShell recognises %computername%. Have a look at environment variables here.

$env:USERNAME, $env:USERDOMAIN $env:COMPUTERNAME look relevant to your task.


Powershell script to schedule daily task error by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply