-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathGet-UCSBladeInv.ps1
45 lines (29 loc) · 1.34 KB
/
Get-UCSBladeInv.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<#
.SYNOPSIS
Get-UcsFaultCount, get the counts of Critical, Major, Minor and Warning faults from a UCS Manager domain
.DESCRIPTION
Get-UcsFaultCount, get the counts of Critical, Major, Minor and Warning faults from a UCS Manager domain
.NOTES
John McDonough, Cisco Systems, Inc. (jomcdono)
#>
param( [Parameter(Mandatory=$true,HelpMessage="Enter UCS Manager IP")]
[string] $ucsHost,
[Parameter(Mandatory=$true,HelpMessage="Enter UCS Manager user")]
[string] $ucsUser,
[Parameter(Mandatory=$true,HelpMessage="Enter UCS Manager user's Password")]
[string] $ucsPass,
[switch] $fromSpark
);
Import-Module -Name Cisco.UCSManager
$credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $ucsUser,$(convertto-securestring -Force -AsPlainText $ucsPass)
$ucs_connection = Connect-Ucs -Name $ucsHost -Credential $credentials
if ($fromSpark) {
$ucsBladeInv = Get-ucsblade | Select-Object ucs, ChassisId, SlotId, OperPower, NumOfCpus, TotalMemory, Serial | Format-Table -AutoSize
#$ucsBladeInv = Get-ucsblade | Select-Object ucs, ChassisId, SlotId, OperPower, NumOfCpus, TotalMemory, Serial
write-output $ucsBladeInv
} else {
$ucsBlades = Get-ucsblade | Select-Object SlotId
$ucsBladesCount = $ucsBlades.Count
"There are $ucsBladesCount UCS blades"
}
$ucs_connection = Disconnect-Ucs