PowerShell Activity - "Requested registry access is not allowed" error RRS feed

  • Question

  • Hello all,

    Sometime the PS activity fire the below error, and I'm not able to figure it out why! Form the activity I'm calling Start-Process 'PowerShell.exe' -Version 3.0 -NonInteractive -OutputFormat Text -file (script path that runs PowerShell 3.0 cmdlets) - Any idea what would be the issue?

    WAL (2.17.1012.0): RunPowerShellScript : RunScript: Exception in 'RunPowerShellScript : RunScript'. Details: System.Security.SecurityException: Requested registry access is not allowed.
       at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
       at System.Environment.GetEnvironmentVariable(String variable, EnvironmentVariableTarget target)
       at System.Management.Automation.ModuleIntrinsics.GetExpandedEnvironmentVariable(String name, EnvironmentVariableTarget target)
       at System.Management.Automation.ModuleIntrinsics.SetModulePath()
       at System.Management.Automation.ExecutionContext.InitializeCommon(AutomationEngine engine, PSHost hostInterface)
       at System.Management.Automation.AutomationEngine..ctor(PSHost hostInterface, RunspaceConfiguration runspaceConfiguration, InitialSessionState iss)
       at System.Management.Automation.Runspaces.LocalRunspace.DoOpenHelper()
       at System.Management.Automation.Runspaces.RunspaceBase.CoreOpen(Boolean syncCall)
       at MicrosoftServices.IdentityManagement.WorkflowActivityLibrary.Activities.RunPowerShellScript.RunScript(String script, IEnumerable scriptArguments, Dictionary`2 scriptParameters)
    The Zone of the assembly that failed was:
    Monday, February 5, 2018 1:51 AM

All replies

  • Confused by "sometimes". If it happens, it should always happen with this script. Probably has to do with ExecutionPolicy or the external script is blocked for execution.
    Monday, February 5, 2018 9:44 AM
  • Did you find a solution for this issue? I am seeing exactly the same when trying to run an AD PS cmdlet as per the documentation here:

    Thursday, April 26, 2018 9:58 AM