How to register a Hyper-V server to a different Azure Site Recovery when you don’t have access to the original subscription 2

Post to Twitter Post to Facebook Post to StumbleUpon

My situation was that were had a trial going with ASR and had associated our Hyper-V server with a site as part of that trial. When moving into production we wanted to use a different ASR site. However when running the setup, it would stop and say that the server was already associated with another site and so it refused our key.

The solution is published by Microsoft but hard to find and not coming up in searches. I’m also told that the script it suggests to use will be built into a tool eventually.

Here is Microsoft’s documentation.

And here is a copy of the script inside that document. Save it with the extension PS1 and run it on your Hyper-V server. This will remove the old site association. Then you can proceed with your installation as normal.

pushd .
      $principal=new-object System.Security.Principal.WindowsPrincipal($windowsIdentity)
      if (!$isAdmin)
         “Please run the script as an administrator in elevated mode.”
         $choice = Read-Host

“This script will remove the old Azure Site Recovery Provider related properties. Do you want to continue (Y/N) ?”
$choice =  Read-Host

if (!($choice -eq ‘Y’ -or $choice -eq ‘y’))
“Stopping cleanup.”

$serviceName = “dra”
$service = Get-Service -Name $serviceName
if ($service.Status -eq “Running”)
“Stopping the Azure Site Recovery service…”
net stop $serviceName

    $asrHivePath = “HKLM:\SOFTWARE\Microsoft\Azure Site Recovery”
$registrationPath = $asrHivePath + ‘\Registration’
$proxySettingsPath = $asrHivePath + ‘\ProxySettings’
     $draIdvalue = ‘DraID’
     if (Test-Path $asrHivePath)
         if (Test-Path $registrationPath)
             “Removing registration related registry keys.”
         Remove-Item -Recurse -Path $registrationPath

        if (Test-Path $proxySettingsPath)
         “Removing proxy settings”
         Remove-Item -Recurse -Path $proxySettingsPath

        $regNode = Get-ItemProperty -Path $asrHivePath
         if($regNode.DraID -ne $null)
             “Removing DraId”
             Remove-ItemProperty -Path $asrHivePath -Name $draIdValue
     “Registry keys removed.”

# First retrive all the certificates to be deleted
$ASRcerts = Get-ChildItem -Path cert:\localmachine\my | where-object {$_.friendlyname.startswith(‘ASR_SRSAUTH_CERT_KEY_CONTAINER’) -or $_.friendlyname.startswith(‘ASR_HYPER_V_HOST_CERT_KEY_CONTAINER’)}
# Open a cert store object
$store = New-Object System.Security.Cryptography.X509Certificates.X509Store(“My”,”LocalMachine”)
# Delete the certs
“Removing all related certificates”
     foreach ($cert in $ASRcerts)
     Write-Host “Error occured” -ForegroundColor “Red”
     Write-Host “FAILED” -ForegroundColor “Red”


Not a Third Tier customer yet? Let me introduce:  We’re Third Tier. We provide advanced Third Tier support for IT Professionals and MicroStaffing for IT consulting firms. Come on over, create an account (no charge) and follow our social media locations. Attend our next chat or webinar:

Third Tier Get Support BlogFeed Blog Twitter Twitter Facebook Facebook LinkedIn LinkedIN

Leave a comment

Your email address will not be published. Required fields are marked *

This blog is kept spam free by WP-SpamFree.

2 thoughts on “How to register a Hyper-V server to a different Azure Site Recovery when you don’t have access to the original subscription