Home Dashboard Directory Help
Search

Improve quality of ErrorRecord object contents by David Wyatt


Status: 

Active


4
0
Sign in
to vote
Type: Suggestion
ID: 792975
Opened: 7/7/2013 7:16:36 PM
Access Restriction: Public
0
Workaround(s)
view

Description

Some cmdlets in PowerShell v3 produce non-terminating errors that don't contain enough information to identify exactly what was being attempted when the error occurred. Get-WmiObject is a good example; if it encounters an "RPC Server is unavailable" message for one of the computers in the -ComputerName argument, the ErrorRecord object which is produced does not contain the ComputerName value anywhere: TargetObject is null. CategoryInfo.TargetName and CategoryInfo.TargetType are empty strings. InvocationInfo.BoundParameters and InvocationInfo.UnboundArguments are empty collections.

There may be other cmdlets that have odd error reporting behavior as well. Get-Service, for example, does not produce any errors when it can't contact a computer specified in the -ComputerName argument, so long as it was able to successfully contact at least one computer and obtain the specified services.
Details
Sign in to post a comment.
Sign in to post a workaround.