Hey helpful people!
I have an issue and I don't understand it:
I want to register a scheduled job on a remote machine, using Credentials of a Local User on the remote Machine.
$PSsession = New-PSSession -Computername "CompName" -Credentials (Get-Credentials)
Invoke-Command -ScriptBlock {Register-ScheduledJob -ScriptBlock {"DoThings"} -Name "myName"} -Session $PSsession
The Session gets established and I can use it with "Enter-PSSession".
But when I try to register the ScheduledJob I get the following Error:
An access denied error occurred when registering scheduled job definition nameme. Try running Windows PowerShell with
elevated user rights; that is, Run As Administrator.+ CategoryInfo : PermissionDenied: (Microsoft.Power...edJobDefinition:ScheduledJobDefinition) [Register-S
cheduledJob], RuntimeException+ FullyQualifiedErrorId : UnauthorizedAccessToRegisterScheduledJobDefinition,Microsoft.PowerShell.ScheduledJob.Reg
isterScheduledJobCommand+ PSComputerName : CompName
Some facts about the environment:
- OS of Client and Server are both "Windows Server 2016" (same issue with 2012R2 on the Server side)
- Same issue if the (target-) server is either a Domain or in a Workgroup
- PowershellRemoting enabled, Executionpolicy="unrestriced"
- local User on Server side is in the local Administrators Group and the "Remote Management Group"
- User Account Control is DISABLED
- I logged on locally once with the user I try to use, to create the Profile in the Filesystem
- Windows Firewall is OFF
It WORKS IF I use a Domain User instead of a local user... but I need it to work on Workgroup Servers!
The problem is reproduceable and I don't get why this does not work.
Has anybody any idea what causes this problem? I appriciate any helpful advice from you.
www.netlogix.de