I think InputObject should be of type PSObject

Topics: Developer Forum
Coordinator
Dec 26, 2006 at 7:39 PM
I base this on the fact that almost all PoSh cmdlets that have an InputObject parameter take PSObject and none of those that don't PSObject take an Object.

44> get-command -type cmdlet | ?{$_.PSSnapIn -notmatch "^PSCX"} |
select -expand ParameterSets | select -expand Parameters |
?{$_.Name -eq "InputObject"} | select ParameterType |
Out-Clipboard -Width 50

ParameterType
-------------
System.Management.Automation.PSObject[]
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Diagnostics.Process[]
System.ServiceProcess.ServiceController[]
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.ServiceProcess.ServiceController[]
System.ServiceProcess.ServiceController[]
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.ServiceProcess.ServiceController[]
System.Diagnostics.Process[]
System.ServiceProcess.ServiceController[]
System.ServiceProcess.ServiceController[]
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject
System.Management.Automation.PSObject[]

Developer
Dec 26, 2006 at 10:42 PM
i agree with the psobject, but i really dont like the properties to be settable, even if protected-only. they wont change the behavior after BeginProcessing() has been called. If you are forced to override them, you know clearly you have to wait for the base class to call you.
Coordinator
Dec 27, 2006 at 4:40 AM
What you suggested and changed looks fine to me. I like having those settings all consolidated into one settings class / property override.