Hello,
Can i run the scheduled task as a local account?
Yes, you can specify any username and password in the Run As section and then use the credentials in your script:
$password = ConvertTo-SecureString -AsPlainText -Force -String $Context.RunAs.Password
$credential = New-Object System.Management.Automation.PsCredential($Context.RunAs.UserName, $password)
$xRemoteCommand1 = `
{
# Do Stuff
}
Invoke-Command -ComputerName %cn% -ScriptBlock $xRemoteCommand1 -credential $credential
When i use an invoke command with a specified credential in my script i get the following:
It looks like you are using a custom module and the Get-StoredCredential cmdlet prompts to enter credentials. It is not possible to use such cmdlets in scripts executed in Adaxes.