What's wrong with my powershell
-
martes, 08 de marzo de 2011 9:35
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
param( [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.
- Cambiado MarcReynolds viernes, 20 de mayo de 2011 15:13 (From:Data Protection Manager)
Todas las respuestas
-
martes, 08 de marzo de 2011 15:44
I figured it out. After making changes I need to call
Set-ProtectionGroup
$mpg
this saves the changes made to the group.
- Marcado como respuesta MSDN Student martes, 08 de marzo de 2011 15:44

