I have created a powershell script which creates volumes and snapmirrors. Near the end I attemp to set a junction point on the target side. I ensure that the snapmirror is initialized and then i do a snapmirror update using Invoke-NcSnapmirrorUpdate. I then wait until it is complete. For some reason the target side junction creation fails with the below error unless 1 of 2 things happens.
1. The snapshot schedule kicks off
2. I manually sync the volume from the web gui in system manager.
mount-NcVol : Failed to create or determine if a junction exists within volume "name_images_mirror". Error occurred with the remaining junction path of "/name_word03" for the given path of "/name_images/name_word03" Reason: Junction create failed (30). At C:\secu\provision hyland.ps1:80 char:22 + ... etVserver | mount-NcVol -name $NewVolNameTarget -JunctionPath $rootJu ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (xx.xxx.xxx.xxx:NcController) [Mount-NcVol], EAPIERROR + FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.Volume.MountNcVol
once the auto scheduled snapmirror update occurs the junction can be created just fine. This leaves me to believe that there is a difference between powershell Invoke-NcSnapmirrorUpdate and the auto update that happens via schedule or the manually done method via system manager gui.
I have obfuscated the IP and names in this example. I am using the latest PS toolkit.
Apparently, In the volume create command you must have and export policy set such as ' -ExportPolicy "default" ' . If this is not set, then just after the snapmirror update when done from system manager GUI or the automatic schedule it will detect that no policy was specified and add default. The powershell snapmirror update does not do this.
It would be nice if the commands were the same. I would recommend modifying the powershell toolkit to pass along -ExportPolicy with a value of "default", even when no -ExportPolicy argument is supplied. In that way it would behave the same as the automatic snapmirror schedule and the GUI snapmirror update.