Simulator Discussions

Powershell DataONTAP cmdlet New-NcDirectory

Rutul

 Can we create directory inside the share which has been created already inside the volume using New-NcDirectory Command?

3 REPLIES 3

chvvkumar

I know this is quite an old topic I am replying to, but in case any one else searching for a similar solution, here is the PowerShell command I got to work:

 

PS D:\> New-NcDirectory -VserverContext SVM_NAME  -Permission 777 /vol/root_volp/folder1/folder2

 

Note the absense of a trailing '/' in the path. Like so:

 

Capture.PNG

Rutul

$Cluster="10.10.10.10";
$ShareName= "netapp";
$dirname="rutulshah";
$VolumeName="vol_home1";
$path="/"+"$VolumeName"+"/";
$Vserver="vser_cifs";

$username="admin";
$password="netapp123";
$PWord = ConvertTo-SecureString –String $password –AsPlainText -Force
$credential=New-Object –TypeName System.Management.Automation.PSCredential –ArgumentList $username, $PWord
Connect-NcController $Cluster -Credential $credential;
Add-NcCifsShare -Name $ShareName -Path $Path -VserverContext $Vserver;

New-NcDirectory /vol/vol_home1/$ShareName/xyz -Permission 0755 -Controller $global:CurrentNcController -VserverContext $Vserver

 

I wrote above script it is creating the folder inside share but giving error : 

 

New-NcDirectory : No such file or directory
At line:15 char:1
+ New-NcDirectory /vol/vol_home1/$ShareName/rutulshah -Permission 0755 -Controller ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (10.63.52.69:NcController) [New-NcDirectory], EONTAPI_ENOENT
+ FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.File.NewNcDirectory

 

JohnChampion

Did you try enclosing the path in quotes? Perhaps it's not parsing the variable.

 

Example:

 

New-NcDirectory "/vol/vol_home1/$ShareName/xyz" -Permission 0755 -Controller $global:CurrentNcController -VserverContext $Vserver

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.

NetApp Insights to Action
I2A Banner
Public