Simulator Discussions

Powershell DataONTAP cmdlet New-NcDirectory

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


Re: Powershell DataONTAP cmdlet New-NcDirectory

$ShareName= "netapp";

$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: ( [New-NcDirectory], EONTAPI_ENOENT
+ FullyQualifiedErrorId : ApiException,DataONTAP.C.PowerShell.SDK.Cmdlets.File.NewNcDirectory


Re: Powershell DataONTAP cmdlet New-NcDirectory

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:



Re: Powershell DataONTAP cmdlet New-NcDirectory

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




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

Cloud Volumes ONTAP
Review Banner
All Community Forums