Power Shell script fails RRS feed

  • Question

  • Half of my active alerts are just power shell failure alerts.

    most of them are

    Forced to terminate the following PowerShell script because it ran past the configured timeout 300 seconds.

    Script Name: SCOMpercentageCPUTimeCounter.ps1

    i did followed

    how best is this suitable.

    does these scripts fail on non English OS like dhcp -


    Lightweight generic discovery script"




    Monday, July 6, 2020 5:36 PM

All replies

  • adding to it



    Failed to run the PowerShell script due to exception below, this workflow will be unloaded.

    System.TypeInitializationException: The type initializer for 'System.Management.Automation.SessionStateScope' threw an exception. ---> System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.

    at System.Collections.Concurrent.ConcurrentDictionary`2.TryAddInternal(TKey key, TValue value, Boolean updateIfExists, Boolean acquireLock, TValue& resultingValue)

    at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, TValue value)

    at System.Management.Automation.PSVariable..ctor(String name, Object value, ScopedItemOptions options, Collection`1 attributes)

    at System.Management.Automation.SessionStateScope..cctor()

    --- End of inner exception stack trace ---

    at System.Management.Automation.SessionStateScope.AddSessionStateScopeDefaultVariables()

    at System.Management.Automation.SessionStateScope.GetPrivateVariables()

    at System.Management.Automation.SessionStateScope.SetVariable(String name, Object value, Boolean asValue, Boolean force, SessionStateInternal sessionState, CommandOrigin origin, Boolean fastPath)

    at System.Management.Automation.SessionStateInternal.InitializeSessionStateInternalSpecialVariables(Boolean clearVariablesTable)

    at System.Management.Automation.SessionStateInternal..ctor(SessionStateInternal parent, Boolean linkToGlobal, ExecutionContext context)

    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 Microsoft.EnterpriseManagement.Common.PowerShell.RunspaceController.RunScript[T](String scriptName, String scriptBody, Dictionary`2 parameters, Object[] constructorArgs, IScriptDebug iScriptDebug, Boolean bSerializeOutput)

    at Microsoft.EnterpriseManagement.Modules.PowerShell.PowerShellProbeActionModule.RunScript(RunspaceController runspaceController)

    Script Name: DiscoverWindowsComputerProperties.ps1

    One or more workflows were affected by this.

    Workflow name: Microsoft.SystemCenter.DiscoverWindowsComputerProperties


    Monday, July 6, 2020 5:43 PM
  • Hi Swapna,

    It seems this is a long-time standing issue now and affects a lot of environments. Unfortunately there's no "solution" for this (yet).

    What you can do is to disable the rule/monitor that is creating this issue.


    Agent processor utilization

    Collect agent processor utilization

    Hope the above information helps.


    Alex Zhu
    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact
    Wednesday, July 8, 2020 3:38 AM
  • usually issue come from agent server is very business.

    1) please isolate the issue whether it related to particular agent or all agents have this issue.

    2) study the problematic agent %process time to find a cue of the cause of agent busy


    Wednesday, July 8, 2020 9:09 AM