Examples 1 of 2:
$a = Get-DhcpServerv4Lease -ComputerName $dhcpbox -IPAddress $port | select
-expand CimInstanceProperties
PS C:\> $a = Get-DhcpServerv4Lease -ComputerName $dhcpbox -IPAddress $port |
select -expand CimInstanceProperties
PS C:\> $a
Name : AddressState
Value : ActiveReservation
CimType : String
Flags : Property, NotModified
IsValueModified : False
Name : ClientId
Value : f4-ce-46-49-fe-d4
CimType : String
Flags : Property, NotModified
IsValueModified : False
Name : ClientType
Value : Dhcp
CimType : String
Flags : Property, NotModified
IsValueModified : False
………
I would like to create a PSCustomObject where I have an IP address in one
column and element 2 from the collection of CimInstanceProperties in another.
Example 2 of 2:
This is in Operations Manager:
PS C:\> $alerts | Where-Object {$_.Name -eq "Veeam VMware: Datastore Unknown
Files Analysis"} | select Parameters,Name | ft -au
Parameters Name
---------- ----
{VMFS01_HD-MD3200_15K_RAID10, 137.73, 78.9, 432.01} Veeam VMware: Datastore
Unknown Files Analysis
{VM_LUN01, 156.93, 71.81, 563.69} Veeam VMware: Datastore
Unknown Files Analysis
{vmware_b2, 276.68, 41.92, 4323.96} Veeam VMware: Datastore
Unknown Files Analysis
{vmware_05, 401.07, 84.09, 444.19} Veeam VMware: Datastore
Unknown Files Analysis
{snap-6c4ca8e6-DEV_VMFS03, 768.75, 75.09, 255} Veeam VMware: Datastore
Unknown Files Analysis
So in both cases I think the column I am interested in is returned as a
collection or array of values. In the latter example, how do I fish out only
the second value in a collection for each monitor name:
e.g. here is what I want as a result:
Veeam VMware: Datastore Unknown Files Analysis 127.73
Veeam VMware: Datastore Unknown Files Analysis 156.93
Veeam VMware: Datastore Unknown Files Analysis 276.68
Veeam VMware: Datastore Unknown Files Analysis 401.07
Veeam VMware: Datastore Unknown Files Analysis 768.75
What’s a good approach in achieving this?
Thanks,
Nile
================================================
Did you know you can also post and find answers on PowerShell in the forums?
http://www.myitforum.com/forums/default.asp?catApp=1