#>
#Read-Host "Please provide the ONTAP Cluster you want to convert"
$Name = Read-Host -Prompt 'Please provide a cluster name'
$Creds = Get-Credential -Message 'provide password'
$ClusterObj = Connect-NcController -Name $Name -Credential $Creds
#Pull blank template
$DPQuery = Get-NcSnapmirror -Template
#Adjust to filter for DP snapmirrors
$DPQuery.RelationshipType = 'data_protection'
$DPQuery.Policy = 'DPDefault'
#Query for DP relationships
$DPRelations = Get-NcSnapmirror -Query $DPQuery -NcController $ClusterObj
#Quiesces the snapmirror relationship
$DPRelations | Invoke-NcSnapmirrorQuiesce -NcController $ClusterObj
#Break the snapmirror relationship
$DPRelations | Invoke-NcSnapmirrorBreak -NcController $ClusterObj -Confirm:$false
#Set the destination volume to disable autodelete of snapshot(s)
$DPRelations | Set-NcSnapshotAutodelete -Volume {$_.DestinationVolume} -Key 'state' -value 'off' -NcController { Connect-NcController -Name $Name -Credential $Creds -Vserver $_.DestinationVserver } | out-null
#Removes / deletes the snapmirror relationship between the source and destination volume
$DPRelations | Remove-NcSnapmirror -NcController $ClusterObj -confirm:$false | out-null
#Create the snapmirror relationship between the source and destination volume
#This will use vault which is XDP, and mirror all snapshots like a normal DP snapmirror setup
$DPRelations | New-NcSnapmirror -Type 'vault' -NcController $ClusterObj -Policy 'MirrorAllSnapshots' | out-null
#Start snapmirror resync
$DPRelations | Invoke-NcSnapmirrorResync -NcController $ClusterObj | Select-Object -Property Status
#Set the destination volume to enable autodelete of snapshot(s)
$DPRelations | Set-NcSnapshotAutodelete -Volume {$_.DestinationVolume} -Key 'state' -value 'on' -NcController { Connect-NcController -Name $Name -Credential $Creds -Vserver $_.DestinationVserver } | out-null```
This code came from Reddit but I have used it with good results in the past.