Register now for better personalized quote!

UCS PowerTool Get-UcsCcoImage and Get-UcsCcoImageList Side Effects!!

Jun, 03, 2013 Hi-network.com

I always find it funny when there is a commercial for a product that is intended to help you but the commercial ends with a low talking voice that casually itemizes the potential side effects. And I usually laugh because I am reminded of the one time popular fat substitute that had a less than pleasant side effect.

However there are sometimes good side effects, the UCS PowerTool PowerShell toolkit has two very powerful cmdlets, one of which has a side effect or should I say "side benefit" that is useful to everyone that downloads software from the Cisco website

Get-UcsCcoImage -Download a software image from the Cisco website.

Get-UcsCcoImageList -Get a list of images that can be downloaded from the Cisco website.

These commands default to UCS images, but lets look at the help forGet-UcsCcoImageList

PS C:\> Get-Help Get-UcsCcoImageList

NAME
Get-UcsCcoImageList

SYNOPSIS
Gets Managed Object of type UcsCcoImage.

SYNTAX
Get-UcsCcoImageList [-MdfId <uint[]>] -Credential [-Proxy ] []

DESCRIPTION
Gets Managed Object of type UcsCcoImage.

RELATED LINKS

REMARKS
To see the examples, type: "get-help Get-UcsCcoImageList -examples".
For more information, type: "get-help Get-UcsCcoImageList -detailed".
For technical information, type: "get-help Get-UcsCcoImageList -full".

The help shows that Get-UcsCcoImageList takes a parameter called the MdfId, what is that?

Lets take a look at the Cisco website download page for UCS PowerTool. UCS PowerTool is found in the grouping for "Cisco UCS Management Partner EcoSystem Software"

 

 

 

 

Take a look at the link, there is an mdfid value in the link, that's what you can use to get a list of Cisco website images with Get-UcsCcoImageList and then select one to download with Get-UcsCcoImage.

Get-UcsCcoImageList returns objects, the object is what needs to be passed to Get-UcsCcoImage. If I wanted to download UCS PowerTool, I would need valid Cisco website credentials. PowerShell will prompt for credentials or you can create a PSCredential object and pass that as a parameter to Get-UcsCcoImageList.

PS C:\> Get-UcsCcoImageList -MdfId 283850978

cmdlet Get-UcsCcoImageList at command pipeline position 1
Supply values for the following parameters:
Credential

mageName : Cisco.UCS.R2.MP.Install.v2.1.0.msi
Version : 2.1.0
Url : http://dl.cisco.com/swc/esd/05/283850978/guest/Cisco.UCS.R2.MP.Install.v2.1.0.msi
IpUrl : http://72.163.7.60/swc/esd/05/283850978/guest/Cisco.UCS.R2.MP.Install.v2.1.0.msi
Size : 2521600
ChecksumMd5 : e920a087de7ea343211cdc6a34ae4988
FileDescription : UCS Manager Management Pack for Microsoft System Center Operations Manager

ImageName : CiscoUcs-PowerTool-1.0.0.0.exe
Version : 1.0.0
Url : http://dl.cisco.com/swc/esd/02/283850978/guest/CiscoUcs-PowerTool-1.0.0.0.exe
IpUrl : http://72.163.7.60/swc/esd/02/283850978/guest/CiscoUcs-PowerTool-1.0.0.0.exe
Size : 8918520
ChecksumMd5 : 19297703ef81ef26576abd1289d97d97
FileDescription : Cisco PowerTool pack for Powershell

There were several objects returned I cut it down to just two, but if I just wanted to get UCS PowerTool images I could use this UCS PowerTool command

PS C:\> Get-UcsCcoImageList -MdfId 283850978 |PS C:\> Get-UcsCcoImageList -MdfId 278468661 | ?{| ?{| ?{$_.FileDescription -like "*PowerTool*"}

cmdlet Get-UcsCcoImageList at command pipeline position 1
Supply values for the following parameters:
Credential

ImageName : CiscoUcs-PowerTool-1.0.0.0.exe
Version : 1.0.0
Url : http://dl.cisco.com/swc/esd/02/283850978/guest/CiscoUcs-PowerTool-1.0.0.0.exe
IpUrl : http://72.163.7.60/swc/esd/02/283850978/guest/CiscoUcs-PowerTool-1.0.0.0.exe
Size : 8918520
ChecksumMd5 : 19297703ef81ef26576abd1289d97d97
FileDescription : Cisco PowerTool pack for Powershell

Now I can pipeline to Get-UcsCcoImage like this

PS C:\> Get-UcsCcoImageList -MdfId 283850978 | ?{$_.FileDescription -like "*PowerTool*"} |_.FileDescription -like "*8.6(1.13)"} | Get-UcsCcoImage -Path C:\Temp| Get-UcsCcoImage -Path C:\Temp

After I enter my credentials the file starts downloading to the Path that I specified. I could have created a PS Credential object and specified as a parameter to Get-UcsCcoImageList.

The cool side effect is that lots of Cisco Software can be downloaded this way, not just UCS. Lets take a look at Cisco IP Communicator

 

 

 

 

The interesting mdfid is 278468661, and when I run Get-UcsCcoImageList I get back quite a few image objects for Cisco IP Communicator.

PS C:\> Get-UcsCcoImageList -MdfId 278468661

cmdlet Get-UcsCcoImageList at command pipeline position 1
Supply values for the following parameters:
Credential

ImageName : cipc-Admin-fes.7-0-5-1.zip
Version : 7.0(5.1)
Url : http://dl.cisco.com/swc/esd/04/278468661/contract/cipc-Admin-fes.7-0-5-1.zip
IpUrl : http://72.163.7.60/swc/esd/04/278468661/contract/cipc-Admin-fes.7-0-5-1.zip
Size : 82257080
ChecksumMd5 : 78cce1768eab5a824e34d7d9ce398515
FileDescription : Cisco IP Communicator v 7.0(5.1)

ImageName : cipc-Admin-fes.8-6-1-13.zip
Version : 8.6(1.13)
Url : http://dl.cisco.com/swc/esd/05/278468661/contract/cipc-Admin-fes.8-6-1-13.zip
IpUrl : http://72.163.7.60/swc/esd/05/278468661/contract/cipc-Admin-fes.8-6-1-13.zip
Size : 79866935
ChecksumMd5 : 1440c188f37e47f420d2de45699c96ef
FileDescription : Cisco IP Communicator v 8.6(1.13)

I cut out a bunch of objects from the listing and left the last two, I can single out the 8.6 version and download it with the command below.

PS C:\> Get-UcsCcoImageList -MdfId 278468661 | ?{$_.FileDescription -like "*8.6(1.13)"} | Get-UcsCcoImage -Path C:\Temp

The key to using these to UCS PowerTool cmdlets is in the Url and IpUrl members of the returned object, if the Url or IpUrl is an actual link to a zip, exe, iso, etc. then this method should work fine. If it is a link to a cgi Perl program then this method won't work for you.

As always I hope this helps with your automation.

follow @johnamcdonough


tag-icon Hot Tags :

Copyright © 2014-2024 Hi-Network.com | HAILIAN TECHNOLOGY CO., LIMITED | All Rights Reserved.