Minor changes to Connect-SscServer output properties.

Changing returned columns from Connect-SscServer to be more in line with other PowerCLI cmdlets.

Signed-off-by: Brian Wuchner <brian.wuchner@gmail.com>
This commit is contained in:
Brian Wuchner
2021-12-06 15:49:33 -05:00
parent 3afa7eed5d
commit 3b7653da71
2 changed files with 9 additions and 9 deletions

View File

@@ -9,12 +9,12 @@
<TableControl> <TableControl>
<TableHeaders> <TableHeaders>
<TableColumnHeader> <TableColumnHeader>
<Width>25</Width> <Width>30</Width>
<Label>Server Name</Label> <Label>Name</Label>
</TableColumnHeader> </TableColumnHeader>
<TableColumnHeader> <TableColumnHeader>
<Width>25</Width> <Width>30</Width>
<Label>Connected As</Label> <Label>User</Label>
</TableColumnHeader> </TableColumnHeader>
<TableColumnHeader> <TableColumnHeader>
<Label>Authenticated</Label> <Label>Authenticated</Label>
@@ -24,10 +24,10 @@
<TableRowEntry> <TableRowEntry>
<TableColumnItems> <TableColumnItems>
<TableColumnItem> <TableColumnItem>
<PropertyName>Server Name</PropertyName> <PropertyName>Name</PropertyName>
</TableColumnItem> </TableColumnItem>
<TableColumnItem> <TableColumnItem>
<PropertyName>Connected As</PropertyName> <PropertyName>User</PropertyName>
</TableColumnItem> </TableColumnItem>
<TableColumnItem> <TableColumnItem>
<PropertyName>Authenticated</PropertyName> <PropertyName>Authenticated</PropertyName>

View File

@@ -36,8 +36,8 @@ Function Connect-SscServer {
$ws.headers.Add('X-Xsrftoken', $webRequest.headers.'x-xsrftoken') $ws.headers.Add('X-Xsrftoken', $webRequest.headers.'x-xsrftoken')
$webRequest = Invoke-WebRequest -Uri "https://$server/account/login" -WebSession $ws -method POST -body (ConvertTo-Json $loginBody) $webRequest = Invoke-WebRequest -Uri "https://$server/account/login" -WebSession $ws -method POST -body (ConvertTo-Json $loginBody)
$webRequestJson = ConvertFrom-JSON $webRequest.Content $webRequestJson = ConvertFrom-JSON $webRequest.Content
$global:DefaultSscConnection = New-Object psobject -property @{ 'SscWebSession'=$ws; 'Server Name'=$server; 'ConnectionDetail'=$webRequestJson; $global:DefaultSscConnection = New-Object psobject -property @{ 'SscWebSession'=$ws; 'Name'=$server; 'ConnectionDetail'=$webRequestJson;
'Connected As'=$webRequestJson.attributes.config_driver +'\'+ $username; 'Authenticated'=$webRequestJson.authenticated; PSTypeName='SscConnection' } 'User'=$webRequestJson.attributes.config_driver +'\'+ $username; 'Authenticated'=$webRequestJson.authenticated; PSTypeName='SscConnection' }
# Return the connection object # Return the connection object
$global:DefaultSscConnection $global:DefaultSscConnection
@@ -105,7 +105,7 @@ Function Get-SscData {
} }
try{ try{
$output = Invoke-WebRequest -WebSession $global:DefaultSscConnection.SscWebSession -Method POST -Uri "https://$($global:DefaultSscConnection.'Server Name')/rpc" -body $(ConvertTo-Json $body) -ContentType 'application/json' $output = Invoke-WebRequest -WebSession $global:DefaultSscConnection.SscWebSession -Method POST -Uri "https://$($global:DefaultSscConnection.Name)/rpc" -body $(ConvertTo-Json $body) -ContentType 'application/json'
$outputJson = (ConvertFrom-Json $output.Content) $outputJson = (ConvertFrom-Json $output.Content)
if ($outputJson.error) { Write-Error $outputJson.error } if ($outputJson.error) { Write-Error $outputJson.error }