MID Server Credential test failing


When attempting in creating a MID Server we have noticed the following error it has generated:

Powershell initialization:

10/23/19 10:16:28 (271) WSMAN Setup SEVERE *** ERROR *** PowerShell will not be available
java.lang.Exception: Error encountered when invoking PowerShell, the result from running '"C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -noninteractive -nologo -noprofile -command "$ver = if (Test-Path Variable:\PSVersionTable) { $PSVersionTable.PSVersion } else { (get-host).Version }; 'full_version:' + $ver.ToString() + ', major_version:' + $ver.Major"' is
at com.service_now.mid.probe.util.PowershellStatus.init(PowershellStatus.java:128)
at com.service_now.mid.probe.util.PowershellStatus.get(PowershellStatus.java:57)
at com.service_now.mid.probe.util.PowershellStatus.getExecutablePath(PowershellStatus.java:80)
at com.service_now.mid.win.powershell.api.PowerConsole.<clinit>(PowerConsole.java:44)
at com.service_now.mid.win.powershell.api.APowershellSession.<init>(APowershellSession.java:77)
at com.service_now.mid.win.powershell.api.LocalPowerShellSession.<init>(LocalPowerShellSession.java:17)
at com.snc.sw.providers.wmi.WMIProviderImpl.setupWsmanDefinition(WMIProviderImpl.java:117)
at com.service_now.mid.services.StartupSequencer$2.lambda$run$0(StartupSequencer.java:304)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)


This could be a couple of scenario as to why we see this:

  1. The issue looks to be with querying Powershell to determine the version, which I see it is looking for version 1 and we currently do not support this, only version 2.0 and greater.
    • C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe
  2. In the following docs for PowerShell version requirements: PowerShell For Discovery
  3. In the following path it is looking in C:\Windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe <-- is this installed?
    • Perhaps, the issue maybe it is not installed.
  4. There may be an AntiVirus Daemon installed which is preventing the MID Server service to running any Powershell initialization.
    • A solution to this is to consult with your security team that manages this. So we can have the MID Server service invoke PowerShell on the MID Server host.
    • This is related to this KB - KB0750324 - "MID Server PowerShell Initialization Issue with error message [Error encountered when invoking PowerShell, the result from running '"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -noninteractive -nologo -noprofile ...]"
  5. Also, the PowerShell execution policy on the MID Server is set to "AllSigned" or "remoteSigned" which would force the policy to throw an error similar to what we are seeing. A simple fix is to set the PowerShell policy to "Unrestricted". However, I highly doubt this would be the case.
  6. Lastly, there may be a possibility of several other powershell.exe entries that exist in the server. You can use the dir functionality to search the directory and all of its children directories while filtering on a particular file type. Use the following command:
    • dir /s /b *.exe | findstr /v .exe