none
remove client from group & delete data on disk RRS feed

  • Question

  • I'm trying to make a script that will compare the list of computers in an OU in AD to the list of currently protected machines in DPM. If its in DPM but not AD, it will check to see if the last recovery point is > 90 days. If so, it will delete everything related to the object.

    I'm getting a little stuck on the part about removing it.

    $ds = Get-DPMDatasource -ComputerNames $not_ad_comp -DPMServerName $DPMServer $pg = Get-ProtectionGroup -DPMServerName $DPMServer | Where-Object { $_.FriendlyName -eq $ds.ProtectionGroup.FriendlyName } $modpg = Get-ModifiableProtectionGroup -ProtectionGroup $pg Remove-ChildDatasource -ProtectionGroup $modpg -ChildDataSource $ds

    .\Remove-ProductionServer.ps1 -DPMServerName $DPMServer -PSName "$not_ad_comp.fqdn"

    EDIT: Looks like I need to type Set-ProtectionGroup -ProtectionGroup $pg after each removal. I had been trying to do it after I looped through and removed them all.


    This finishes without an error, but the object remains in the protection group. The last line then errors because it still has an active replica. How do I fix this? 



    • Edited by robdtec Tuesday, October 16, 2012 7:39 PM
    Tuesday, October 16, 2012 5:50 PM

Answers

  • Hi Robdtec,

    Steps when working with a modifiable protection group are:

    Get-ProtectionGroup
    Get-ModifiableProtectionGroup
    <Perform actions on the protection group>
    Set-ProtectionGroup

    http://technet.microsoft.com/en-us/library/ff631876.aspx

    $ds = Get-DPMDatasource -ComputerNames $not_ad_comp -DPMServerName $DPMServer
    $pg = Get-ProtectionGroup -DPMServerName $DPMServer | Where-Object { $_.FriendlyName -eq $ds.ProtectionGroup.FriendlyName }
    $modpg = Get-ModifiableProtectionGroup -ProtectionGroup $pg
    Remove-ChildDatasource -ProtectionGroup $modpg -ChildDataSource $ds
    Set-ProtectionGroup $modpg

    .\Remove-ProductionServer.ps1 -DPMServerName $DPMServer -PSName "$not_ad_comp.fqdn"

    Stephane


    Please remember to click “Mark as Answer” on the post that helps you. This posting is provided "AS IS" with no warranties. knowledge is valid only if it is shared by All.

    My DPM blog Yet Another DPM Blog

    • Proposed as answer by Stephane LADUNE Tuesday, October 16, 2012 7:35 PM
    • Marked as answer by robdtec Tuesday, October 16, 2012 7:38 PM
    Tuesday, October 16, 2012 7:35 PM
  • Stephane,

    Looks like we were off by just a few seconds with my edit and your reply. I had been trying to set the protection group after doing a "batch update" on the group. Apparently this doesn't work too well. I've taken to just using the set- command after each removal as indicated.

    • Marked as answer by robdtec Tuesday, October 16, 2012 7:38 PM
    Tuesday, October 16, 2012 7:38 PM

All replies

  • Hi Robdtec,

    Steps when working with a modifiable protection group are:

    Get-ProtectionGroup
    Get-ModifiableProtectionGroup
    <Perform actions on the protection group>
    Set-ProtectionGroup

    http://technet.microsoft.com/en-us/library/ff631876.aspx

    $ds = Get-DPMDatasource -ComputerNames $not_ad_comp -DPMServerName $DPMServer
    $pg = Get-ProtectionGroup -DPMServerName $DPMServer | Where-Object { $_.FriendlyName -eq $ds.ProtectionGroup.FriendlyName }
    $modpg = Get-ModifiableProtectionGroup -ProtectionGroup $pg
    Remove-ChildDatasource -ProtectionGroup $modpg -ChildDataSource $ds
    Set-ProtectionGroup $modpg

    .\Remove-ProductionServer.ps1 -DPMServerName $DPMServer -PSName "$not_ad_comp.fqdn"

    Stephane


    Please remember to click “Mark as Answer” on the post that helps you. This posting is provided "AS IS" with no warranties. knowledge is valid only if it is shared by All.

    My DPM blog Yet Another DPM Blog

    • Proposed as answer by Stephane LADUNE Tuesday, October 16, 2012 7:35 PM
    • Marked as answer by robdtec Tuesday, October 16, 2012 7:38 PM
    Tuesday, October 16, 2012 7:35 PM
  • Stephane,

    Looks like we were off by just a few seconds with my edit and your reply. I had been trying to set the protection group after doing a "batch update" on the group. Apparently this doesn't work too well. I've taken to just using the set- command after each removal as indicated.

    • Marked as answer by robdtec Tuesday, October 16, 2012 7:38 PM
    Tuesday, October 16, 2012 7:38 PM