cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1268
Views
0
Helpful
1
Replies

Scripting UCS FI 2.x NX-OS Commands

JohnathanPaul
Level 1
Level 1

Has anyone successfully scripted UCS 2.x NX-OS commands (such as show system uptime, and show platform software cmccrtl process meminfo | i MemFree) that can be run across multiple domains which passes credentials?  Apparently cannot be done using PowerTools.  It would be helpful to regularly run certain commands that do not exist in PowerTools to assess the health of memory usage and system up time.

1 Reply 1

Larry Hedrick
Level 1
Level 1

I do not know how robust this solution will end up but you can run ssh commands from powershell using WMF 5 and the Posh-SSL Cmdlets.

https://www.powershellgallery.com/GettingStarted?section=Get%20Started
https://www.powershellgallery.com/packages/Posh-SSH/


##########
# Getting SSH Command Info from UCS via Powershell
# Needs:
# https://www.powershellgallery.com/packages/Posh-SSH/
# See getting started to install WMF 5.0
# 1/6/2016 - Larry Hedrick

# Begin

Write-Host "Connecting to UCSM..." -ForegroundColor Cyan
New-SSHSession -ComputerName 'dat01-clucs-003'

Write-Host "Running Commands..." -ForegroundColor Cyan
Invoke-SSHCommand -Command 'show cluster state' -SessionId '0' | select -ExpandProperty Output

Write-Host "Disconnecting." -ForegroundColor Cyan
Remove-SSHSession -SessionId 0

#end


Output


Connecting to UCSM...
cmdlet New-SSHSession at command pipeline position 1
Supply values for the following parameters:

SessionId  Host                                                          Connected                                            
---------  ----                                                          ---------                                            
    0      dat01-clucs-003                                                 True                                               
Running Commands...
Cluster Id: 0xfa5cfdda8dd511e3-0xb6bc000573e36044

B: UP, PRIMARY
A: UP, SUBORDINATE

HA READY
Disconnecting.
True

Review Cisco Networking products for a $25 gift card