Scripting Removal of Old Laptops DPM 2012 R2

Hi All, I'm trying to automate as much of DPM as possible and one of the tasks is to clear up old laptops. 

I currently have a script that will return a list of laptops that no longer exist in AD and want to remove them en mass from DPM. As far as I'm aware I need to remove them from the PG and then remove them from the DPM server but I'm having trouble working out how to do this. The TechNet Article here talks about using Remove-ChildDataSource so I set about trying to figure out what that by using Get-ChildDataSource but that's where I've come unstuck. I can't seem to get the command to work or figure out what the ChildDataSource item refers to at a code level.

Is there a way to cleanly remove a laptop from DPM via the CLI?

We back up "computername.domain.com\User Data"

May 25th, 2015 8:43pm

Hi,

Instead of using PowerShell, can you simply stop the protection group, choose Retain Protected Data and recreate it with remain/existing computers?

Free Windows Admin Tool Kit Click here and download it now
May 26th, 2015 6:18am

If we have a PG with several hundred laptops that seems a pretty drastic approach just to remove a couple of decommissioned ones. Surely it is possible to script the removal.

As above I'm wanting to write a script for automation so I can schedule it or run it on demand, not have to use the gui to remove multiple machines from the PG.

  • Edited by [Malco] 10 hours 21 minutes ago
May 26th, 2015 4:45pm

If we have a PG with several hundred laptops that seems a pretty drastic approach just to remove a couple of decommissioned ones. Surely it is possible to script the removal.

As above I'm wanting to write a script for automation so I can schedule it or run it on demand, not have to use the gui to remove multiple machines from the PG.

  • Edited by [Malco] Tuesday, May 26, 2015 8:48 PM
Free Windows Admin Tool Kit Click here and download it now
May 26th, 2015 8:45pm

If we have a PG with several hundred laptops that seems a pretty drastic approach just to remove a couple of decommissioned ones. Surely it is possible to script the removal.

As above I'm wanting to write a script for automation so I can schedule it or run it on demand, not have to use the gui to remove multiple machines from the PG.

  • Edited by [Malco] Tuesday, May 26, 2015 8:48 PM
May 26th, 2015 8:45pm

Hi Malco,

I've posted an example on how to use the Remove-ChildDataSource. Modify and combine it with your list of removed laptops to only remove the correct DataSources.

# Get all your protection groups
$Pg = Get-ProtectionGroup -DPMServerName "DPMServer01"

# The Get-DPMModifiableProtectionGroup cmdlet retrieves the first protection group listed in $Pg in an editable mode.
$Mpg = Get-ModifiableProtectionGroup $Pg[0]

# Get all Datasources from the first protection group listed in $Pg
$Ds = Get-Datasource -ProtectionGroup $Pg[0]

# Remove the first datasource listed in $Ds from protection group in $Mpg
Remove-DPMChildDatasource -ProtectionGroup $Mpg -ChildDatasource $Ds[0] 

#Run the Set-DPMProtectionGroup cmdlet to save the changed protection group.
Set-DPMProtectionGroup -ProtectionGroup $Mpg

Hope it helps!

Kind Regards
Markus


Free Windows Admin Tool Kit Click here and download it now
May 27th, 2015 7:30pm

Hi Malco,

I've posted an example on how to use the Remove-ChildDataSource. Modify and combine it with your list of removed laptops to only remove the correct DataSources.

# Get all your protection groups
$Pg = Get-ProtectionGroup -DPMServerName "DPMServer01"

# The Get-DPMModifiableProtectionGroup cmdlet retrieves the first protection group listed in $Pg in an editable mode.
$Mpg = Get-ModifiableProtectionGroup $Pg[0]

# Get all Datasources from the first protection group listed in $Pg
$Ds = Get-Datasource -ProtectionGroup $Pg[0]

# Remove the first datasource listed in $Ds from protection group in $Mpg
Remove-DPMChildDatasource -ProtectionGroup $Mpg -ChildDatasource $Ds[0] 

#Run the Set-DPMProtectionGroup cmdlet to save the changed protection group.
Set-DPMProtectionGroup -ProtectionGroup $Mpg

Hope it helps!

Kind Regards
Markus


  • Marked as answer by [Malco] 5 hours 25 minutes ago
May 27th, 2015 11:29pm

Hi Malco,

I've posted an example on how to use the Remove-ChildDataSource. Modify and combine it with your list of removed laptops to only remove the correct DataSources.

# Get all your protection groups
$Pg = Get-ProtectionGroup -DPMServerName "DPMServer01"

# The Get-DPMModifiableProtectionGroup cmdlet retrieves the first protection group listed in $Pg in an editable mode.
$Mpg = Get-ModifiableProtectionGroup $Pg[0]

# Get all Datasources from the first protection group listed in $Pg
$Ds = Get-Datasource -ProtectionGroup $Pg[0]

# Remove the first datasource listed in $Ds from protection group in $Mpg
Remove-DPMChildDatasource -ProtectionGroup $Mpg -ChildDatasource $Ds[0] 

#Run the Set-DPMProtectionGroup cmdlet to save the changed protection group.
Set-DPMProtectionGroup -ProtectionGroup $Mpg

Hope it helps!

Kind Regards
Markus


  • Marked as answer by [Malco] Friday, May 29, 2015 1:44 AM
Free Windows Admin Tool Kit Click here and download it now
May 27th, 2015 11:29pm

Hi Markus

That's great, works perfectly and give me a base to build out on.

Thanks!

May 28th, 2015 9:46pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics