none
PowerShell: Stop protection of member... RRS feed

  • Question

  • From the GUI of DPM 2012 it is possible to stop the protection of a member and delete the replica on disk.

    I'm looking for a way to accomplish the same via PowerShell. I want to automate this for the protected laptops in DPM.

    I think Remove-DPMChildDatasource should be used, but I can't get it to work.

    http://technet.microsoft.com/en-us/library/hh881780(v=sc.20).aspx

    Thursday, June 19, 2014 11:35 AM

Answers

  • Hi,

    here you can find a PowerShell Script which i wrote for my Blog, should help.

    ########################################################
    #Name: RemoveDsToScdpm.ps1                             #
    #Creator: Michael Seidl aka Techguy                    #
    #CreationDate: 27.11.2013                              #
    #LastModified:27.11.2013                               #
    #Version: 1.0                                          #
    #Doc: http://www.techguy.at/tag/removedstoscdpm/       #
    ########################################################
    #www.techguy.at                                        #
    #www.facebook.com/TechguyAT                            #
    #www.twitter.com/TechguyAT                             #
    #michael@techguy.at                                    #
    ########################################################
    
    
    #Get-Module -ListAvailable
    Import-Module DataProtectionManager
    
    #Variables
    $Protectiongroup="SQLBronceProtectionGroup"
    $Database="ServiceManager"
    $Server="SVATANSQ01"
    $DPMServer="dsvatandpr2"
    
    #Magic
    $PG=Get-DPMProtectionGroup -DPMServerName $DPMServer | where {$_.Name -eq $Protectiongroup}
    
    $PS=Get-ProductionServer $DPMServer | where {$_.ServerName -eq $Server}
    
    $DS=Get-DPMDatasource -ProtectionGroup $PG | where {$_.Name -eq $Database}
    
    $MPG = Get-ModifiableProtectionGroup $PG
    
    Remove-ChildDatasource -ChildDatasource $DS -ProtectionGroup $MPG
    
    Set-protectiongroup $MPG
    
    
    


    Seidl Michael | http://www.techguy.at | twitter.com/techguyat | facebook.com/techguyat

    Thursday, June 19, 2014 2:54 PM

All replies

  • Hi,

    here you can find a PowerShell Script which i wrote for my Blog, should help.

    ########################################################
    #Name: RemoveDsToScdpm.ps1                             #
    #Creator: Michael Seidl aka Techguy                    #
    #CreationDate: 27.11.2013                              #
    #LastModified:27.11.2013                               #
    #Version: 1.0                                          #
    #Doc: http://www.techguy.at/tag/removedstoscdpm/       #
    ########################################################
    #www.techguy.at                                        #
    #www.facebook.com/TechguyAT                            #
    #www.twitter.com/TechguyAT                             #
    #michael@techguy.at                                    #
    ########################################################
    
    
    #Get-Module -ListAvailable
    Import-Module DataProtectionManager
    
    #Variables
    $Protectiongroup="SQLBronceProtectionGroup"
    $Database="ServiceManager"
    $Server="SVATANSQ01"
    $DPMServer="dsvatandpr2"
    
    #Magic
    $PG=Get-DPMProtectionGroup -DPMServerName $DPMServer | where {$_.Name -eq $Protectiongroup}
    
    $PS=Get-ProductionServer $DPMServer | where {$_.ServerName -eq $Server}
    
    $DS=Get-DPMDatasource -ProtectionGroup $PG | where {$_.Name -eq $Database}
    
    $MPG = Get-ModifiableProtectionGroup $PG
    
    Remove-ChildDatasource -ChildDatasource $DS -ProtectionGroup $MPG
    
    Set-protectiongroup $MPG
    
    
    


    Seidl Michael | http://www.techguy.at | twitter.com/techguyat | facebook.com/techguyat

    Thursday, June 19, 2014 2:54 PM
  • Thanks Michael, your script only needed just a little bit of editing before it worked to remove protected client computers

    "{$_.ServerName" changed to "where {$_.Computer"

    #Import Modules
    Import-Module DataProtectionManager
    
    #Variables
    $Protectiongroup="ProtectionGroupName"
    $Computer="LaptopName"
    $DPMServer="DPMServerName"
    
    $PG=Get-DPMProtectionGroup -DPMServerName $DPMServer | where {$_.Name -eq $Protectiongroup}
    $DS=Get-DPMDatasource -ProtectionGroup $PG | where {$_.Computer -eq $Computer}
    $MPG = Get-ModifiableProtectionGroup $PG
    Remove-ChildDatasource -ChildDatasource $DS -ProtectionGroup $MPG
    Set-protectiongroup $MPG


    Wednesday, June 25, 2014 1:34 PM