07-17-2018 08:20 AM
Has anyone managed to use the UCS Central PowerShell cmdlets to successfully tag a server / adapter with the required tags for HCR? We wish to automate this during the OS build / installation of driver updates and whenever there's a service profile migration, to ensure the HCR is valid when applying new firmware packages.
There's limited help with the cmdlets, so I can't be sure I've got the syntax correct, but I've looked at existing tags that have been created through the GUI and they looks like this:
PS > Get-UcsCentralTagSoftwareInst
DefDn : holder/tag-def-ep/type-Operating System for HCR
DefName : Operating System for HCR
ObjectName : test-cluster 1/1
ObjectType : computeBlade
SrcDme : resource-mgr
TaggedObjectDn : compute/sys-1011/chassis-1/blade-1
Value : Microsoft Windows Server 2016
Vendor : Microsoft
Version : Windows Server 2016
UcsCentral : lonpucs01
Dn : holder/tag-ep/type-Operating System for HCR-inst-[Microsoft Windows Server 2016]-obj-[compute/sys-1011/chassis-1/blade-1]
Rn : blade-1]
Status :
XtraProperty : {}
So I'm expecting the following to work:
Add-UcsCentralTagSoftwareInst `
-DefName 'Operating System for HCR' `
-TaggedObjectDn "compute/sys-1011/chassis-5/blade-1" `
-Value "Microsoft Windows Server 2016" `
-Vendor "Microsoft" `
-Version "Windows Server 2016"
It doesn't. It returns the below:
Add-UcsCentralTagSoftwareInst : testucs01:configured object (holder/tag-ep/type-Operating System for HCR-inst-Microsoft Windows Server 2016-obj-compute/sys-1011/chassis-5/blade-1) not found
At line:1 char:5
+ Add-UcsCentralTagSoftwareInst `
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (unidentified-fail:String) [Add-UcsCentralTagSoftwareInst], Exception
+ FullyQualifiedErrorId : 102,Cisco.UcsCentral.Cmdlets.AddUcsCentralTagSoftwareInst
Note that the object it's looking for is:
holder/tag-ep/type-Operating System for HCR-inst-Microsoft Windows Server 2016-obj-compute/sys-1011/chassis-5/blade-1
Which is missing the square brackets of the DN of existing tag objects:
holder/tag-ep/type-Operating System for HCR-inst-[Microsoft Windows Server 2016]-obj-[compute/sys-1011/chassis-1/blade-1]
So then I try putting in the brackets:
Add-UcsCentralTagSoftwareInst `
-DefName 'Operating System for HCR' `
-TaggedObjectDn "[compute/sys-1011/chassis-5/blade-1]" `
-Value "[Microsoft Windows Server 2016]" `
-Vendor "Microsoft" `
-Version "Windows Server 2016"
This returns no error, so it must have created the object, right?? Er, no...
Ok, let's forget the cmdlet intended for this purpose and just create the object manually:
$osTagProps = @{
DefName = 'Operating System for HCR'
TaggedObjectDn = 'compute/sys-1011/chassis-5/blade-1'
Value = 'Microsoft Windows Server 2016'
Vendor = 'Microsoft'
Version = 'Windows Server 2016'
}
$null = Get-UcsCentralManagedObject -Dn holder/tag-ep | `
Add-UcsCentralManagedObject -ClassId TagDriver -PropertyMap $osTagProps
WARNING: Rn part of Dn does not match computed Rn. Dn holder/tag-ep/type-Operating System for HCR-inst-Microsoft Windows Server 2016-obj-compute/sys-1011/chassis-5/blade-1 Computed Rn type-Operating System for
HCR-inst-Microsoft Windows Server 2016-obj-compute/sys-1011/chassis-5/blade-1.
WARNING: Parent part of Dn does not match Parent MO Dn. Dn holder/tag-ep/type-Operating System for HCR-inst-Microsoft Windows Server 2016-obj-compute/sys-1011/chassis-5/blade-1 Parent holder/tag-ep.
Add-UcsCentralManagedObject : lonpucs01:configured object (holder/tag-ep/type-Operating System for HCR-inst-Microsoft Windows Server 2016-obj-compute/sys-1011/chassis-5/blade-1) not found
At line:2 char:5
+ Add-UcsCentralManagedObject -ClassId TagDriver -PropertyMap $osTa ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (unidentified-fail:String) [Add-UcsCentralManagedObject], Exception
+ FullyQualifiedErrorId : 102,Cisco.UcsCentral.Cmdlets.AddUcsCentralManagedObject
This looks to be the same error as before (unsurprising given that the cmdlet is likely just a wrapper to create the object) in that it doesn't create the square brackets when building the DN, which it then expects. Adding the brackets in again causes it to complete with the same warnings, but without the errors and ultimately no object is created
WARNING: Rn part of Dn does not match computed Rn. Dn holder/tag-ep/type-Operating System for HCR-inst-[Microsoft Windows Server 2016]-obj-[compute/sys-1011/chassis-5/blade-1] Computed Rn type-Operating System for
HCR-inst-[Microsoft Windows Server 2016]-obj-[compute/sys-1011/chassis-5/blade-1].
WARNING: Parent part of Dn does not match Parent MO Dn. Dn holder/tag-ep/type-Operating System for HCR-inst-[Microsoft Windows Server 2016]-obj-[compute/sys-1011/chassis-5/blade-1] Parent holder/tag-ep.
In desperation, I've even logged the GUI whilst tagging the server manually, but using ConvertTo-UcsCentralCmdLet returns nothing.
Has anyone else had any luck this this?
Thanks,
Tom
02-01-2019 01:48 AM
Any news on this issue? I am having the same problem when trying to use the Add-UcsCentralTagSoftwareInst commandlet.
I am using the most recent UCS PowerToolkit 2.5.1.6.
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide