Handling Equivalent Objects in multiple VMM Libraries

Everyone who has to work with a central VMM management server installation and multiple VMM Libraries in different sites has to deal with the equivalent objects. Managing equivalent objects through the VMM console is not appropriate, if you have a lot of objects in your VMM Library.

-> https://technet.microsoft.com/en-us/library/gg610650.aspx

Some weeks ago I was faced again with the equivalent objects. So I decided to write some lines of PowerShell to lighten the marking of the equivalent objects.

I implemented the marking for ISO images, VHD images, scripts and custom resources in a PowerShell script. It is simple, but it works wonderful.

ISO Images:

$ISOs=Get-SCISO
foreach($ISO in $ISOs){
foreach($TEMPISO in $ISOs){
if($ISO.Name -eq $TEMPISO.Name -and $ISO.SharePath -ne $TEMPISO.SharePath){
$Temp=$ISO.Name
Set-SCISO -ISO $ISO -FamilyName $Temp -Release "1.0.0.0"
}
}
}

VHD Images:

$VHDs=Get-SCVirtualHardDisk
foreach($VHD in $VHDs){
foreach($TEMPVHD in $VHDs){
if($VHD.Name -eq $TEMPVHD.Name -and $VHD.SharePath -ne $TEMPVHD.SharePath){
$Temp=$VHD.Name
Set-SCVirtualHardDisk -VirtualHardDisk $VHD -FamilyName $Temp -Release "1.0.0.0"
}
}
}

Scripts:

$Scripts=Get-SCScript
foreach($Script in $Scripts){
foreach($TEMPScript in $Scripts){
if($Script.Name -eq $TEMPScript.Name -and $Script.SharePath -ne $TEMPScript.SharePath){
$Temp=$Script.Name
Set-SCScript -Script $Script -FamilyName $Temp -Release "1.0.0.0"
}
}
}

Custom Resources:

$CRs=Get-SCCustomResource
foreach($CR in $CRs){
foreach($TEMPCR in $CRs){
if($CR.Name -eq $TEMPCR.Name -and $CR.SharePath -ne $TEMPCR.SharePath){
$Temp=$CR.Name
Set-SCCustomResource -CustomResource $CR -FamilyName $Temp -Release "1.0.0.0"
}
}
}
Facebooktwittergoogle_pluslinkedinmail

Leave a Reply