cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2381
Views
0
Helpful
2
Replies

Read a list of UCS IP's and report back all NTP servers per UCS

kg6itcraig
Level 1
Level 1

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

My UCS Blog http://realworlducs.com
2 Replies 2

nveda
Level 1
Level 1

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

  }

}

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

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: