Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Select-Value{
- [Cmdletbinding()]
- Param(
- [parameter(Mandatory=$true)] [String] $Value,
- [parameter(ValueFromPipeline=$true)] $InputObject
- )
- Process{
- # Identify the PropertyName for respective matching Value, in order to populate it Default Properties
- $Property = ($PSItem.properties.Where({$_.Value -Like "$Value"})).Name
- If($Property){
- # Create Property a set which includes the 'DefaultPropertySet' and Property for the respective 'Value' matched
- $DefaultPropertySet = $PSItem.PSStandardMembers.DefaultDisplayPropertySet.ReferencedPropertyNames
- $TypeName = ($PSItem.PSTypenames)[0]
- Get-TypeData $TypeName |Remove-TypeData
- Update-TypeData -TypeName $TypeName -DefaultDisplayPropertySet ($DefaultPropertySet+$Property |Select-Object -Unique)
- # Output Objects
- $PSItem | Where-Object {$_.properties.Value -like "$value"}
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement