Skip to content

Commit b509433

Browse files
bnichmsBrian Nichols
andauthored
StackHCI - Change output type on new cmdlets (#16398)
Co-authored-by: Brian Nichols <[email protected]>
1 parent 71b7964 commit b509433

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

src/StackHCI/Az.StackHCI.psm1

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -264,18 +264,6 @@ enum ImdsAttestationNodeStatus
264264
Expired;
265265
Error;
266266
}
267-
class AzStackHCIImdsStatus
268-
{
269-
[string] $ComputerName
270-
[ImdsAttestationNodeStatus] $Status
271-
[System.Nullable[DateTime]] $Expiration
272-
AzStackHCIImdsStatus([PSObject]$other)
273-
{
274-
$this.ComputerName = $other.ComputerName
275-
$this.Status = $other.Status
276-
$this.Expiration = $other.Expiration
277-
}
278-
}
279267

280268
$registerArcScript = {
281269
try
@@ -3819,9 +3807,13 @@ param(
38193807

38203808
$firewallRule = Invoke-Command @SessionParams -ScriptBlock { param($ruleName) Enable-NetFirewallRule -Name $ruleName } -ArgumentList $TemplateHostImdsParams["NetFirewallRuleName"]
38213809

3822-
$nodeAttestation = [AzStackHCIImdsStatus] (Invoke-Command @SessionParams -ScriptBlock { Get-AzureStackHCIAttestation })
3810+
$nodeAttestation = (Invoke-Command @SessionParams -ScriptBlock { Get-AzureStackHCIAttestation })
38233811

3824-
$enableImdsOutputList.Add($nodeAttestation) | Out-Null
3812+
$enableImdsOutput = New-Object -TypeName PSObject
3813+
$enableImdsOutput | Add-Member -MemberType NoteProperty -Name ComputerName -Value ($nodeAttestation.ComputerName)
3814+
$enableImdsOutput | Add-Member -MemberType NoteProperty -Name Status -Value ([ImdsAttestationNodeStatus]($nodeAttestation.Status))
3815+
$enableImdsOutput | Add-Member -MemberType NoteProperty -Name Expiration -Value ($nodeAttestation.Expiration)
3816+
$enableImdsOutputList.Add($enableImdsOutput) | Out-Null
38253817
}
38263818
elseif ($WhatIfPreference.IsPresent)
38273819
{
@@ -4051,8 +4043,12 @@ param(
40514043

40524044
Invoke-Command @SessionParams -ScriptBlock { param($switchId); Set-AzureStackHCIAttestation -SwitchId $switchId } -ArgumentList ([Guid]::Empty) | Out-Null
40534045

4054-
$nodeAttestation = [AzStackHCIImdsStatus] (Invoke-Command @SessionParams -ScriptBlock { Get-AzureStackHCIAttestation })
4055-
$disableImdsOutputList.Add($nodeAttestation) | Out-Null
4046+
$nodeAttestation = (Invoke-Command @SessionParams -ScriptBlock { Get-AzureStackHCIAttestation })
4047+
$disableImdsOutput = New-Object -TypeName PSObject
4048+
$disableImdsOutput | Add-Member -MemberType NoteProperty -Name ComputerName -Value ($nodeAttestation.ComputerName)
4049+
$disableImdsOutput | Add-Member -MemberType NoteProperty -Name Status -Value ([ImdsAttestationNodeStatus]($nodeAttestation.Status))
4050+
$disableImdsOutput | Add-Member -MemberType NoteProperty -Name Expiration -Value ($nodeAttestation.Expiration)
4051+
$disableImdsOutputList.Add($disableImdsOutput) | Out-Null
40564052

40574053
}
40584054
catch

0 commit comments

Comments
 (0)