Microsoft Virtualization Discussions

Using powershell to make NFS exports after making flexclone

gertvangorp

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

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

Announcements
NetApp on Discord Image

We're on Discord, are you?

Live Chat, Watch Parties, and More!

Explore Banner

Meet Explore, NetApp’s digital sales platform

Engage digitally throughout the sales process, from product discovery to configuration, and handle all your post-purchase needs.

Public