none
Powershell script to perform mass uninstall of DPM agents on remote machines RRS feed

  • Question

  • We have approximately 200 Windows 7 SP1 client machines (all members of the same domain) that have the DPM 2012 agent installed, they are spread out over the US and Canada. They are all pointing to a DPM server that is no longer in service. It looks like my only option is to uninstall the client agent, and then re-install from one of our other DPM servers so we can continue protecting them. Does anyone know of a DPM power shell script that will do this? I hoped I could feed it (the script) a text file of the machines that need to have the agent uninstalled.

    HDL

    Tuesday, August 9, 2016 3:25 PM

Answers

  • We found a work-around after further investigate. In short, most of the machines were no longer on-line, so we just did a select all and uninstalled the agent.

    HDL

    • Marked as answer by Winterthur Thursday, August 11, 2016 5:53 PM
    Thursday, August 11, 2016 5:53 PM

All replies

  • # modify and try in the lab this script
    Add-PSSnapIn "Microsoft.DataProtectionManager.PowerShell" -ErrorAction SilentlyContinue
    
    $dpmserver = dpm1.domain.ru
    
    #in the file hosts4remove.txt write FQDN workstation or servers on which we need to delete from PG and need to delete agents
    $List= Get-Content "C:\script\removehost\hosts4remove.txt"
    foreach ($host4deletion in $List) 
    {
        #get list protection group
        $pgList = Get-ProtectionGroup $dpmserver
        
        #if you have only one protection group (PG) - for ex. usersbackup - that index must be 1, for ex. $pgList[1]
    
        #get the list of data source from PG usersbackup
        $dslist = get-datasource($pglist[1])
    
        # finding index of data source with name $host4deletion at the massive of protected server 
        $indx = 0..($dslist.Count -1) | where {$dslist.computer[$_] -eq $host4deletion}
    
        #deleting severs from PG
        $mpg = Get-ModifiableProtectionGroup $pgList[1]
        write-host ("Remove data source " + $dslist[$indx].computer)
        Remove-ChildDataSource -ProtectionGroup $mpg -ChildDataSource $dslist[$indx]
        Set-ProtectionGroup $mpg
        write-host ("Removing $host4deletion from PG complete") -ForeGroundColor Green
    
        #Removing DPM agents from 
        Remove-ProductionServer.ps1 $dpmserver "host4deletion
        write-host ("Removing dpm agent from $host4deletion complete") -ForeGroundColor Green
    }
    <# usefull PoSH command
    
    #output all RP
    
    $rplist=get-recoverypoint $dslist[$indx]
    foreach($rp in $rplist){
    write-host $rp.representedpointintime
    }
    
    #list of object that have RecoveryPoints less than 3х
    #$dslist |where {[int]$_.TotalRecoveryPoints -lt 3} |ft -Wrap -AutoSize ProductionServerName
    
    #>


    Have a nice day !!!
    DPM 2012 R2: Remove Recovery Points
    DPM blog
    System Center
    Hyper-V

    Thursday, August 11, 2016 3:16 PM
    Moderator
  • We found a work-around after further investigate. In short, most of the machines were no longer on-line, so we just did a select all and uninstalled the agent.

    HDL

    • Marked as answer by Winterthur Thursday, August 11, 2016 5:53 PM
    Thursday, August 11, 2016 5:53 PM