Powershell SnapMirror

Hi, I have done a snapmirror between clusters, and feel fairly comfortable with the process, what i was wanting to know was how do i find out the status of a snapmirror in progress, how much data has been moved and how long the process has been running. I know via command line how to do it, but could anyone show me how to do it in powershell.

we are currently on a fas8020 running 8.3.1. Any help most appreciated.

Re: Powershell SnapMirror

‎2017-04-2109:28 AM

Have you looked at the Get-NcSnapMirror cmdlet? I believe that if you speciffy only one relationship it will return all of the attributes for that relationship. I do not have a working lab to test that, but it should be quick to check. The Get-NcSnapMirrorHistory may also have the information that you are looking for, but I am not sure if it will return it for a running update.

Re: Powershell SnapMirror

‎2017-04-2401:35 PM

Hi Geringer, though the command is useful it doesnt provide the detail that i need. I can see how this command can be used to monitor mirror history of comms. I will definately be using this in the future in my toolkit.

Re: Powershell SnapMirror

‎2017-04-2607:17 AM

Hi, Just set another snapmirror to go now, and i can see the results via ssh.

Using the command above, in " GB Transferred Min Elapsed" i just aget a 0 all the way down. There are names in "SourceLocation" and "DestinationLocation" but nothing in the last column, also the snapmirror that i have set of cannot be seen anywhere in this command.

[parameter(Mandatory=$false, HelpMessage="Approximate transfer size in MB. Used to calculate the percentage progress for SnapMirror relationships on Clustered ONTAP 8.2 or later.")][long]$TransferSize)

function Wait-For-Initialization-V1{# Use query template so ONTAP will not have to return all the jobs, but only the relevant ones (unfortunately its not currently possible to filter by matching JobDescription)$query = Get-NcJob -Template$query.JobType = "Transfer-Initialize"

if(!$job){# No job was found, it could be that the job was purged or that no job was created# because the vsm relationship is already in 'snapmirrored' state.# Checking that the vsm relationship is in 'snapmirrored' state$vsm = Get-NcSnapmirror -SourceCluster $SourceCluster -DestinationCluster $DestinationCluster -SourceVserver $SourceVserver -DestinationVserver $DestinationVserver -SourceVolume $SourceVolume -DestinationVolume $DestinationVolume -ErrorAction SilentlyContinue

# Job is not found and relationship is not in 'snapmirrored' state..# verify that the paramters passed to this command are matching the parameters# supplied to the Create VSM command. if yes, then the initialization failed.# if not, it means this command was executed with wrong parameter values and# should be executed with the correct ones.

# Retrieve the relationship to check if it is 8.1-style or 8.2-style# relationship. This is indicated by the relationship control plane.# For 8.1-style relationships (control plane V1), there is a job in ONTAP# whose status we can check. For 8.2-style relationship (control plane V2),# there is no job. We just wait for the relationship state to# become 'snapmirrored'.#

# Temporary workaround to handle an issue in snapmirror-get-iter API for SnapMirror relationships of infinite volume.# Instead of sending all keys of a SnapMirror relationship (destination-cluster, destination-vserver, destination-volume, source-cluster, source-vserver, source-volume),# one of the keys destination-volume will not be sent