Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Can we create directory inside the share which has been created already inside the volume using New-NcDirectory Command?
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
$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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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:
