Hi,
I'm trying to get data from two different cmdlets into the same format-table output. Here is what I'm trying to run (SCOM-specific):
$SQLWindowsClustersMMState = Get-SCOMClass -Name 'Microsoft.Windows.Cluster' | Get-SCOMClassInstance | Where {$_.Name -like "SQL"}
Variable output:
HealthState InMaintenanceMode DisplayName
Uninitialized True SQL02
The above gives a DisplayName property, which I then want to carry into the ft at the end of the below, as the Get-SCOMMaintenanceMode cmdlet only gives a MonitoringObjectId GUID-style field and no Name or DisplayName property:
$SQLWindowsClustersMMState| Where {$SQLWindowsClustersMMState.InMaintenanceMode -eq $true}|Get-SCOMMaintenanceMode|ft DisplayName,ScheduledEndTime
DisplayName ScheduledEndTime
13/02/2023 11:57:26
I've tried ft $SQLWindowsClustersMMState.DisplayName,ScheduledEndTime, which puts the server DisplayName into the Header:
SQL02 ScheduledEndTime
13/02/2023 11:57:26
I also tried ft MonitoringObjectId,@{Label="DisplayName";Expression=$SQLWindowsClustersMMState.DisplayName},ScheduledEndTime, with no luck:
MonitoringObjectId DisplayName ScheduledEndTime
------------------ ----------- ----------------
d45f0eb8-78f8-19e4-62fa-c3b1174efb92 13/02/2023 11:57:26
What am I doing wrong?