Read a list of UCS IP's and report back all NTP servers per UCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2015 04:05 PM
Wanted to see the NTP servers configured for a UCS. If anyone wants to edit up a version that can read a list of UCS IP's and report back all NTP servers per UCS, that would rock. Thanks!
Hope this helps someone on their path towards enlightenment.
#
# Check module dependencies
#
if ((Get-Module |where {$_.Name -ilike "CiscoUcsPS"}).Name -ine "CiscoUcsPS")
{
Write-Host "Loading Module: Cisco UCS PowerTool Module"
Import-Module CiscoUcsPs
}
$UcsmAddress = "172.16.0.1"
#Get Credentials
$Creds = Get-Credential
#define UCS connection
$UCSMHandle = Connect-Ucs $UcsmAddress $creds #Connect to the UCS
#Get NTP Server
Get-UcsNtpServer -Ucs $UCSMHandle
-----------
See both NTP Servers.
Output:
AdminState : enabled
Descr :
Hostname :
Name : 172.16.0.2
Dn : sys/svc-ext/datetime-svc/ntp-172.16.0.2
Rn : ntp-172.18.10.103
Status :
XtraProperty : {}
Ucs : ucshdp
AdminState : enabled
Descr :
Hostname :
Name : 172.16.0.3
Dn : sys/svc-ext/datetime-svc/ntp-172.16.0.3
Rn : ntp-172.23.200.98
Status :
XtraProperty : {}
Ucs : ucshdp
- Labels:
-
UCS Integrations
-
UCS PowerTool
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2015 05:56 AM
Hi Craig Simpson,
Can you try following.
$ucsArray = @("<ucs1>", "<ucs2>", "<ucs3>")
Set-UcsPowerToolConfiguration -SupportMultipleDefaultUcs 1
foreach ($ucs in $ucsArray)
{
Try {
#Get Credentials
Write-Host "Enter credential for: $($ucs)"
$Creds = Get-Credential
${ucsCon} = Connect-Ucs -Name ${ucs} $creds -ErrorAction SilentlyContinue
if ($ucsCon -eq $null)
{
Write-Host "Can't login to: $($ucs)"
continue
}
#Get NTP Server
Write-Host "NTP Server for: $($ucs)"
Write-Host ""
Get-UcsNtpServer
#Disconnect from UCS
Disconnect-Ucs
}
Catch {
Write-Host "Error connecting to UCS Domain: $($ucs)"
Write-Host "${Error}"
exit
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2015 05:59 AM
Hi Craig,
In case you have common credential for all UCS domains try following.
Set-UcsPowerToolConfiguration -SupportMultipleDefaultUcs 1
$user = "<username>"
$password = "<password>" | ConvertTo-SecureString -AsPlainText -Force
$cred = New-Object System.Management.Automation.PSCredential($user, $password)
$servers = @("<ucs1>", "<ucs2>", "<ucs3>")
Connect-Ucs $servers -Credential $cred
# List NTP Server in each UCS domain
Get-UcsNtpServer
