Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Scheduled Tasks with group managed service accounts

$
0
0

I am trying to create a scheduled task via powershell on a remote machine using a group managed service account as the scheduled task principal.  The commands I run are below

 

$hostname = "RemoteComputer"

$Argument = ".\test.ps1"

$Action = New-ScheduledTaskAction powershell.exe -Argument $Argument -WorkingDirectory c:\scripts\

$Trigger = New-ScheduledTaskTrigger -Once –At "1/1/2014 3:00 AM"

$Principal = New-ScheduledTaskPrincipal -UserId Domain\GSMA$ -LogonType Password -RunLevel Highest

Register-ScheduledTask "Test Script" -action $Action -Trigger $Trigger -Principal $Principal -CimSession $hostname

 

 

I get the strange error "the NtCreateFile API failed. This error should never be returned to an application it is a place holder for the Windows Lan Manager Redirector to use in its internal error mapping routine"  

 

If I change the principal from the gsma to a local system or administrator the commands works fine when executed from a remote computer

If I run the commands locally on the remote computer the script works.  

I believe the issue my be permission related but not sure what exactly.  I have also added the gsma account to be a local administrator but I still get the same error.  Any thoughts or suggestion would be greatly appreciated


Viewing all articles
Browse latest Browse all 8583

Trending Articles