The MID Server WinRMAPI PowerShell Module update to the PSModulePath system variable is failing


Description

The MID Server WinRMAPI PowerShell Module update to the PSModulePath system variable is failing with the below error during Discovery or Credential testing:

Command [$env:PSModulePath = $env:PSModulePath + "XXX\agent/scripts/Powershell/WinRMAPI"] timed out after PT2M

Cause

The Service Account used for running the ServiceNow MID Server does not have permissions to update the MID WinRMAPI PowerShell Module to the PSModulePath system variable.

Resolution

Run the below command on the MID Server from the PowerShell prompt and restart the MID Server:
$env:PSModulePath = $env:PSModulePath + ";<path-to-MID-Server-agent-folder>\agent/scripts/Powershell/WinRMAPI"


where <path-to-MID-Server-agent-folder>  is the path to the MID Server agent folder