forked from movinalot/ucs-alexa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGet-ImcSerial.ps1
33 lines (24 loc) · 914 Bytes
/
Get-ImcSerial.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
<#
.SYNOPSIS
Get-ImcSerial, Get the serial number from a Cisco UCS Rack Server
.DESCRIPTION
Get-ImcSerial, Get the serial number from a Cisco UCS Rack Server
.NOTES
John McDonough, Cisco Systems, Inc. (jomcdono)
#>
param( [Parameter(Mandatory=$true,HelpMessage="Enter Server IP")]
[string] $Server,
[Parameter(Mandatory=$true,HelpMessage="Enter Server user")]
[string] $User,
[Parameter(Mandatory=$true,HelpMessage="Enter Server user's Password")]
[string] $Pass
);
Import-Module -Name Cisco.IMC
$credentials = new-object -typename System.Management.Automation.PSCredential -argumentlist $User,$(convertto-securestring -Force -AsPlainText $Pass)
$imc_connection = Connect-Imc -Name $Server -Credential $credentials
$serialno = $(Get-ImcRackUnit).Serial
for($x = 0; $x -lt $serialno.length; $x++) {
$newserialno += $serialno[$x] + ", "
}
$newserialno
$imc_connection = Disconnect-Imc