I would like to be able to move collection in sms 2003 via powershell
Plan
Find the collection id of the collection I want to move
Find the collection id of the collection I want to be the new parent
script
Connect to the "SMS_CollectToSubCollect" class
$c = Get-WmiObject -class "SMS_CollectToSubCollect" -namespace
"root\SMS\site_c01" -computerName "sms-srv" |
Where-Object { $_.parentCollectionID -match "C01002BE"}
I am trying to change the parent connection string using
Using get-member $c I got
parentCollectionID Property System.String parentCollectionID {get;set;}
subCollectionID Property System.String subCollectionID {get;set;}
__CLASS Property System.String __CLASS {get;set;}
And
Put ScriptMethod System.Object Put();
Script
$c | ForEach-Object{
Write-Host $_.parentCollectionID
Write-Host $_.subCollectionID
$_.parentCollectionID = "C01002BC" # new parent
$_.parentCollectionID.set
$_.put()
Write-Host $_.parentCollectionID
Write-Host $_.subCollectionID
#
}
Doesn’t work??????


