0 Replies Latest reply on May 24, 2014 9:47 AM by leinhard

    Using Powershell to get the information from Nexus series


      Hello, There

      i am using the powershell to get the OS Version info from the Nexus 3048 Device.

      want to this line split into the variables and get only 6.0(2)U3(1) how can i do it. i am testing now.


      kickstart: version 6.0(2)U3(1)

      system:    version 6.0(2)U3(1)



      ============CODE BELOW============================


      $f = @'
      Cisco Nexus Operating System (NX-OS) Software


      TAC support: http://www.cisco.com/tac


      Documents: http://www.cisco.com/en/US/products/ps9372/tsd_products_support_serie5/24/2014s_home.html


      Copyright (c) 2002-2014, Cisco Systems, Inc. All rights reserved.


      The copyrights to certain works contained herein are owned by


      other third parties and are used and distributed under license.


      Some parts of this software are covered under the GNU Public


      License. A copy of the license is available at








        BIOS:      version 1.2.0


        loader:    version N/A


        kickstart: version 6.0(2)U3(1)


        system:    version 6.0(2)U3(1)


        Power Sequencer Firmware:


                   Module 1: version v4.4


        BIOS compile time:       08/25/2011


        kickstart image file is: bootflash:///n3000-uk9-kickstart.6.0.2.U3.1.bin


        kickstart compile time:  5/12/2014 2:00:00 [05/12/2014 10:39:24]


        system image file is:    bootflash:///n3000-uk9.6.0.2.U3.1.bin


        system compile time:     5/12/2014 2:00:00 [05/12/2014 12:27:06]







        cisco Nexus 3048 Chassis ("48x1GE + 4x10G Supervisor")


        Intel(R) Celeron(R) CPU        P450 with 3785024 kB of memory.


        Processor Board ID FOC18070YCQ




        Device name: As_1.nx3048.krccn


        bootflash:    2007040 kB




      Kernel uptime is 0 day(s), 6 hour(s), 55 minute(s), 24 second(s)




      Last reset at 90718 usecs after  Mon May 19 03:58:17 2014




        Reason: Disruptive upgrade


        System version: 6.0(2)U3(1)



      $output = $f -split ("`r`n")

             foreach ($line in $output) {
                  switch -wildcard ($line)
                      #"*kickstart: version*" {$A = $line.Substring(21)}
                        "*kickstart: version*" {$A = $line.trim()}

           switch -wildcard ($line)
                      #"*system:    version*" {$B = $line.Substring(21)}
                      "*system:    version*" {$B = $line.trim()}

      $A -split(" ")


      ======================RESULTS ARE==============

      PS C:\nbp> .\140524_string_parse_test.ps1





      PS C:\nbp>