-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet-ArubaOSSwitchSystem.ps1
30 lines (24 loc) · 1.26 KB
/
Get-ArubaOSSwitchSystem.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
function Get-ArubaOSSwitchSystem
{
<#
.Synopsis
This function returns the details of ArubaOS-Switch Network Switch
.DESCRIPTION
This function returns the details of ArubaOS-Switch Network Switch including the Model Name/Number, Hardware Infomation, PoE Support and any blades fitted.
.EXAMPLE
To get infomation about the switch sw-swspare01.example.com using the cookie stored in $ArubaOS use the following.
Get-ArubaOSSwitchSystem -ArubaOSCookie $ArubaOSCookie -Switch sw-swspare01.example.com
#>
param(
[Parameter(Mandatory=$true,HelpMessage="Provide the Parameter that the login session obtained from Get-ArubaOSLogin")]
$ArubaOSCookie,
[Parameter(Mandatory=$true,HelpMessage="Enter the hostname for the switch you are connecting to")]
[String]$Switch
)
#Force PowerShell to use TLS1.2
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::TLS12
#Allow the use of self signed certs (to be improved upon in later releases)
[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}
#Query the switch for its status
Invoke-RestMethod -Method Get -Uri https://$Switch/rest/v1/system/status/switch -DisableKeepAlive -Headers @{"cookie"="$ArubaOSCookie"}
}