9300 switch upgrade template

Has anyone created a template for the 9300 switches? 

Have been working on this for a couple days and came up with the following but having issues getting it to push to all switches.  I took the template I had and modified it but have not had 100% success.

This change script allows you to script IOS upgrades
This runs on Cisco IOS devices for 9300 Switch

NCM Node
The node the template will operate on. All templates require this by default. The target node is selected during the first part of the wizard so it will not be available for selection when defining values of variables.

The File Name of the new IOS Version.
This should be a valid Cisco IOS File.No spaces are allowed, a script will not be generated for a Cisco IOS Filename that includes a space.

.PARAMETER_LABEL @change_Radius
Delete and Replace existing Radius.

Enter "y" to replace existing Radius. Enter "n" to leave existing Radius Configuration.

.PARAMETER_LABEL @reloadWhenComplete
RELOAD device after transfer?
Enter "y" to reload the device after upgrade. Enter "n" to only copy the bin files to flash.


script UpgradeIOS (
NCM.Nodes @ContextNode,
string @reloadWhenComplete)

string @CommandLine = 'copy tftp://x.x.x.x/' + @IOS_FILENAME + ' flash:'

if (@IOS_FILENAME contains ' ')

foreach ( in @ContextNode )

if ( .Vendor == 'Cisco' )
request platform software package install switch all file flash:@IOS_FILENAME auto-copy
conf t
no boot system
boot system flash:@IOS_FILENAME
if (@reloadWhenComplete contains 'y')


Script will push to first switch but not going to all subsequent stack switches.


  • Hi shinska,

    Some extra info can be found in the cisco release notes for 9300 switches IOS-XE. I assume you are running the devices in Install Mode.

    Here a link for the: Release Notes for Cisco Catalyst 9300 Series Switches, Cisco IOS XE Fuji 16.9.x 

    They describe a 6 step process on upgrading

    In a nut shell:
    1) Clean up: request platform software package clean switch all + install remove inactive --> can also be done afterwards if you are sure there is enough space on the flash memory.
    2) Copy new image: Covered in your '@CommandLine' + '@IOS_FILENAME'
    3) Set boot var: boot system switch all flash:/packages.conf + write
    4) Install image: As mentioned in the CLI part (request platform software package install switch all file flash:@IOS_FILENAME auto-copy)
    5) Check install & boot system: show flash-X (x is switch number) & show boot system (each switch should state flash:/packages.conf)
    6) Reload the switch (stack).

    Hope this helps.