What's wrong with my powershell RRS feed

  • Question

  • I am writing a powershell script which will delete all protection groups, child data source and their data. (so basically clean the DPM Server up).

    this is what i have written

    	[string] $DPMServerName = $(throw "Please specify the DPM ServerName. Example .\DPMConfig.ps1 -DPMServerName <DPMServer>")
    $DPMServer = 'mydpmserver'
    Connect-DPMServer -DPMServerName $DPMServer
    $pgList = Get-ProtectionGroup -DPMServerName $DPMServer
    foreach($pg in $pgList) {	
    	$mpg = Get-ModifiableProtectionGroup $pg
    	$dsList = Get-DataSource -ProtectionGroup $pg
    	foreach($ds in $dsList) {
    		write-host ("going to remove data source " + $ds.Name)
    		Remove-ChildDataSource -ProtectionGroup $mpg -ChildDataSource $ds	<br/>
    Disconnect-DPMServer -DPMServerName $DPMServer

    it prints the name of all data sources which are going to be removed. then if I re-run the script it prints the names again. Also if I run the DPM Admin console, I see that nothing has been deleted.


    • Moved by MarcReynolds Friday, May 20, 2011 3:13 PM (From:Data Protection Manager)
    Tuesday, March 8, 2011 9:35 AM


  • I figured it out. After making changes I need to call




    this saves the changes made to the group.

    • Marked as answer by MSDN Student Tuesday, March 8, 2011 3:44 PM
    Tuesday, March 8, 2011 3:44 PM