NetApp Community Update
This site will enter Read Only mode on July 23 as we prepare to move to a new platform. You will still be able to view content, but posting and replying will be temporarily disabled.
We're excited to launch our new Community experience on July 30 and more information will follow soon.
Stay connected during the transition - Join our Discord community today.

Microsoft Virtualization Discussions

Using powershell to make NFS exports after making flexclone

gertvangorp
4,518 Views

Hi,

For a customer of mine I need to make a script that dos the following

We have a master NFS datastore.  To create classes we need to "clone the nfs datastore" and make new nfs datastores of in inside a VMware environment.

The cusotmer is using a C mode ontap environment.  And we need to work in a vserver environment.

the script I have is working for 95%, only making a NFS export of the flexclone volume is not working....

her the script I use

$password

= ConvertTo-SecureString "MyPassword" -AsPlainText -Force

$cred

= New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList "MyUser",$password

## Add the  DATA ONTAP Module

Import-module DataONTAP


## Connecto to netapp filer

Connect-NcController -Name CMODENETAPP-Credential $cred

## Create new snapshot on master and give it the Teacher AD name and instance number

New-NcSnapshot -TargetName "master" -SnapName "00" -VserverContext "MyvServer"

## Create new flexclones based on MasterLUN and instance snapshot

New-NcVolClone -ParentVolume "master" -CloneVolume "WA01" -ParentSnapshot "00" -VserverContext "MyVserver"

then I want to use

Add-NcNfsExport cmdlet to create the nfs export point for the newly created volume WA01 in my case but I get an error telling me that the namesppace is incorect.....  anybody here that can help me to finish this task or give me an example??

Wen I do this via ssh or via the manual in the interface its working, it does not work with powershell/

Thanks for your help..

Gert

1 REPLY 1

skiser
4,518 Views

Gert,

Can you send an example of the cmdlet you are using that isn't working?  I use Add-NaNfsExport in the following manner:

$path = "/vol/<volname>/<qtreename>"

Add-NaNfsExport -Persistent:$true -Path $path -ReadWrite @('192.168.10.0/24','192.168.28.0/24') -Root @('192.168.10.0/24','192.168.28.0/24') | Out-Null

Thanks,

-Steve

Public