Answered by:
Powershell discoveries not working, EventID:22406 The term 'out-default' is not recognized

Question
-
On 1 of my agent managed systems i get a lot of errors in the Operations Manager eventlog and they indicate that there's something wrong with the powershell.
Het PowerShell-script is mislukt met onderstaande uitzondering
System.Management.Automation.CommandNotFoundException: The term 'out-default' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at System.Management.Automation.Runspaces.Pipeline.Invoke()
at Microsoft.EnterpriseManagement.Common.PowerShell.RunspaceController.RunScript[T](String scriptName, String scriptBody, Dictionary`2 parameters, Object[] constructorArgs, IScriptDebug iScriptDebug, Boolean bSerializeOutput)
Searching for this error i found that it could be the setting of the variable $env:psmodulepath.
When reading the value of it directly on the system it all seems ok:
PS C:\Users\svc-scom-msaa> $env:psmodulepath
C:\Users\svc-scom-msaa\Documents\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules\;C:\Program Files\Citrix\PowerShell Modules\;C:\Pro
gram Files\Microsoft Monitoring Agent\Agent\PowerShell\
So being smart (i thought) i created a management pack that just runs a powershell discovery with this script:
$api = new-object -comObject 'MOM.ScriptAPI'
$api.LogScriptEvent('PSModulepath:',20,4,$env:psmodulepath)
$api.LogScriptEvent('PSVersion:',20,4,$PSVersionTable.PSVersion)
and expected to see in the eventlog which version and path is being used. But ofcourse this script generates the same error as above.
Anyone have an idea how to troubleshoot this further?Versions:
SCOM 2012R2 ur8
Agent manage system Windows 2008R2stdSP1Monday, July 11, 2016 12:49 PM
Answers
-
No i have not. In the mean time we are upgraded to scom 2016 and i've not seen this alert since then.
Gr,
Ronald
Ronald
- Marked as answer by Ronald.van.den.Berg Wednesday, July 26, 2017 9:11 AM
Wednesday, July 26, 2017 9:11 AM
All replies
-
Hi Sir,
>>The term 'out-default' is not recognized as the name of a cmdlet, function, script file,
>>Agent manage system Windows 2008R2stdSP1
You have mentioned it is a windows 2008R2 server .
But this cmdlet "out-default" is a command under PS3.0 and later .
https://technet.microsoft.com/en-us/library/hh849721(v=wps.620).aspx
Based on my understanding , this might be the issue here .
In addition , please try to upgrade PS version for that server and test again :
http://www.happysysadm.com/2012/06/upgrading-to-powershell-30-on-windows.html
Hope it is useful to you .
Best Regards,
Elton
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com .
Wednesday, July 13, 2016 6:25 AM -
Hi Elton,
Thanks for your reply, i should have mentioned that PS3 is already installed on that system so this can not be the solution.
Gr,
RonaldWednesday, July 13, 2016 7:27 AM -
Hi Sir,
That command can be queried ?
Get-command out-default
Best Regards,
Elton
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com .
Wednesday, July 13, 2016 8:35 AM -
Good question i didn't try until now:
PS K:\> Get-command out-default
CommandType Name ModuleName
----------- ---- ----------
Cmdlet Out-Default Microsoft.PowerShell.CoreSo, yes it can.
Gr,
RonaldWednesday, July 13, 2016 8:38 AM -
I have the same error on:
SCOM 2012R2 ur11
Agent manage system Windows 2008R2stdSP1using PS4, any update?
Wednesday, July 26, 2017 8:41 AM -
No i have not. In the mean time we are upgraded to scom 2016 and i've not seen this alert since then.
Gr,
Ronald
Ronald
- Marked as answer by Ronald.van.den.Berg Wednesday, July 26, 2017 9:11 AM
Wednesday, July 26, 2017 9:11 AM -
We also have the error since last week updates: KB4025341 and KB4020322
SCOM 2012R2 UR13
Agent manage System: Windows 2008R2 SP1System.Management.Automation.CommandNotFoundException: The term 'out-default' is
not recognized as the name of a cmdlet, function, script file, or operable program.PowerShell Version on Client: 4.0
Get-command out-default
CommandType Name ModuleName
----------- ---- ----------
Cmdlet Out-Default Microsoft.PowerShell.CoreThursday, July 27, 2017 8:28 AM