none
Automatically include all Hyper-V guests? RRS feed

  • Question

  • I thought 2012 would automatically include any new Hyper-V machines added to a Hyper-V host?  I have a protection group set up for a Hyper-V server and had selected the HyperV option when setting up the protection group.  I then added a Hyper-V guest machine and it was not added into the protection group.

    Is automatically protecting all Hyper-V guest machines supposed to happen with 2012?

     


    Rob
    • Moved by Larry Yin Wednesday, March 28, 2012 11:12 PM (From:DPM 2012 Beta - Locked)
    Friday, November 18, 2011 1:57 AM

Answers

  • I created a different script which uses existing Hyper-V machines on the Host OS to determine the protection policy.  It does assume a Hyper-V guest is already protected and just accounts for new ones on existing protected Hyper-V machines.  It doesn't require any inputs and skips machines that are not in a protection group already.  It leverages the scripts you linked to and has some similarities.  Posted it hear just in case someone finds it useful.

     

    # Pull all protection groups on the server and iterate
    # through to make sure all Hyper-V guests are protected
    #
    # IMPORTANT ASSUMPTIONS!!
    # This script only adds in Hyper-V guests for hosts that are
    # already under protection and adds it to the protection group of other
    # Hyper-V guests on that machine
    
    # Hyper-V Writer guid
    $guid = "66841cd4-6ded-4f4b-8f17-fd23f8ddc3de"
    
    # Get the list of protected servers
    $complist = Get-ProductionServer -DPMServerName (&hostname) | ?{($_.IsHavingDatasourcesProtected)}
    
    # Get the list of data sources for these machines
    $dslist = @()
    foreach ($a in $complist)
    {
       $dslist += Get-Datasource -ProductionServer $a -Inquire
    }
    
    # Find the ones that are Hyper-V and not protected.  If found, find another Hyper-V guest on
    # that machine, determine first PG, and then add the unprotected Hyper-V guest to the same protection group.
    $unprotectedList = @($dslist | ? {$($_.Type.IsDatasource) -and ($($_.Type.Id) -match $guid) -and ! $($_.Protected)})
    foreach ($ds in $unprotectedList)
    {
       $protectedList = @($dslist | ? {$($_.Type.IsDatasource) -and $($_.ProductionServerName -eq $ds.ProductionServerName) -and ($($_.Type.Id) -match $guid) -and $($_.Protected)})
       $pg = $protectedList[0]
       write-host "Unprotected Hyper-V found:" $ds.Name
       write-host "Adding to Protection Group:" $pg.ProtectionGroupName
       $mpg = Get-ModifiableProtectionGroup $pg.ProtectionGroup
       Add-ChildDatasource -ProtectionGroup $mpg -ChildDatasource $ds
       Get-DatasourceDiskAllocation -Datasource $ds
       Set-DatasourceDiskAllocation -Datasource $ds -ProtectionGroup $mpg
       Set-ReplicaCreationMethod -ProtectionGroup $mpg -Now
       Set-protectiongroup $mpg
    }
    



    Rob
    • Marked as answer by ip-rob Friday, November 18, 2011 7:19 PM
    Friday, November 18, 2011 7:19 PM

All replies

  • Yes, DPM 2012 doesn't have automatic addition as you have thought .  But there are powershell scripts available to do this for DPM.

    Please refer to following wiki article for complete details. http://social.technet.microsoft.com/wiki/contents/articles/577.aspx

    Friday, November 18, 2011 5:51 AM
  • This is an issue that I first reported to the DPM team in June of 2006 when we participated in the beta for DPM 2007.  At that time it was related to automatically protecting new SQL databases (they weren't automatically added).

    It is hard to believe that the UI still doesn't do the same thing as every other backup product in terms of selection within the hierarchy.  If HyperV is selected, all sub-items should be added automatically just like a file server would have a new folder protected.

    Is there a reason the subselection doesn't work for HyperV?  

    Do new databases automatically get protected for SQL?  

    What about Exchange changes?

     


    Rob
    Friday, November 18, 2011 1:45 PM
  • I created a different script which uses existing Hyper-V machines on the Host OS to determine the protection policy.  It does assume a Hyper-V guest is already protected and just accounts for new ones on existing protected Hyper-V machines.  It doesn't require any inputs and skips machines that are not in a protection group already.  It leverages the scripts you linked to and has some similarities.  Posted it hear just in case someone finds it useful.

     

    # Pull all protection groups on the server and iterate
    # through to make sure all Hyper-V guests are protected
    #
    # IMPORTANT ASSUMPTIONS!!
    # This script only adds in Hyper-V guests for hosts that are
    # already under protection and adds it to the protection group of other
    # Hyper-V guests on that machine
    
    # Hyper-V Writer guid
    $guid = "66841cd4-6ded-4f4b-8f17-fd23f8ddc3de"
    
    # Get the list of protected servers
    $complist = Get-ProductionServer -DPMServerName (&hostname) | ?{($_.IsHavingDatasourcesProtected)}
    
    # Get the list of data sources for these machines
    $dslist = @()
    foreach ($a in $complist)
    {
       $dslist += Get-Datasource -ProductionServer $a -Inquire
    }
    
    # Find the ones that are Hyper-V and not protected.  If found, find another Hyper-V guest on
    # that machine, determine first PG, and then add the unprotected Hyper-V guest to the same protection group.
    $unprotectedList = @($dslist | ? {$($_.Type.IsDatasource) -and ($($_.Type.Id) -match $guid) -and ! $($_.Protected)})
    foreach ($ds in $unprotectedList)
    {
       $protectedList = @($dslist | ? {$($_.Type.IsDatasource) -and $($_.ProductionServerName -eq $ds.ProductionServerName) -and ($($_.Type.Id) -match $guid) -and $($_.Protected)})
       $pg = $protectedList[0]
       write-host "Unprotected Hyper-V found:" $ds.Name
       write-host "Adding to Protection Group:" $pg.ProtectionGroupName
       $mpg = Get-ModifiableProtectionGroup $pg.ProtectionGroup
       Add-ChildDatasource -ProtectionGroup $mpg -ChildDatasource $ds
       Get-DatasourceDiskAllocation -Datasource $ds
       Set-DatasourceDiskAllocation -Datasource $ds -ProtectionGroup $mpg
       Set-ReplicaCreationMethod -ProtectionGroup $mpg -Now
       Set-protectiongroup $mpg
    }
    



    Rob
    • Marked as answer by ip-rob Friday, November 18, 2011 7:19 PM
    Friday, November 18, 2011 7:19 PM