DSC: Error: Index operation failed; the array index evaluated to null (UserRightsAssignment)

Aus Wiki-WebPerfect
Wechseln zu: Navigation, Suche
01-event 4103.png

Error

The following error occurs when you try to run Start-DscConfiguration -UseExisting -Wait -Verbose:
Index operation failed; the array index evaluated to null.

In the Windows Eventlog you can see a similar error, Event ID 4103 in Microsoft-Windows-Desired-State-Configuration/Operational:
This event indicates that a non-terminating error was thrown when DSCEngine was executing Test-TargetResource on MSFT_UserRightsAssignment DSC resource. FullyQualifiedErrorId is NullArrayIndex. Error Message is Index operation failed; the array index evaluated to null..


Cause

This is maybe because your temporary local security policy is corrupt.
DSC uses the PowerShell Module "SecurityPolicyDsc" located at one of the Windows PowerShell module directories.
This module generates a temporary local security Policy (C:\Windows\TEMP\SecurityPolicy.inf). You can see this if you enable the DSC debug log:
02-event 4118.png

Stupid is that DSC does not simply overwrite the local security policy.


Solution

  • Rename or delete the temporary local security policy (C:\Windows\TEMP\SecurityPolicy.inf).
  • Run your DSC command again and it should work.