Microsoft Virtualization Discussions

PowerShell Toolkit ;error with New-NcSym

Quang-Chinh
8,888 Views

Dear all, 

 

Customer is reporting an issue with PowerShell Toolkit when trying to create a new symlink.

Actually, he is stuck on a big project so any fast help would be very appreciated.

 

Target File « test.txt »

  • The target file is seen by powershell1.png2.png
  • Exécution on the command New-NcSymLink with issue3.png

 

  • You have executed this command without « /vol » on traget or symlink but without success.
  • The symlink file « test2.txt » is created but symlink is not functional.

4.png

 

5.png

 

 

<contact info removed by moderator>

1 ACCEPTED SOLUTION

Ontapforrum
8,660 Views

Hi,

 

I followed this KB article, and it worked perfectly in my lab. Screenshot attached.

 

How to create a symbolic link in clustered Data ONTAP without the need for NFS:
https://kb.netapp.com/app/answers/answer_view/a_id/1029854


Lab:
simulator:ONTAP 9.6

PSversion:4

 

Note: Original & symlink file need not exist prior, first will be created during command-line execution, and test_copy will be created automatically.
symlink: test_copy
original: test

View solution in original post

7 REPLIES 7

Ontapforrum
8,866 Views

Please look at the example given in this blog: [Very well written]

 

I think the order and syntax needs correction.

 

Go to this section:
How we create some Symlinks with PowerShell
https://community.netapp.com/t5/Network-Storage-Protocols-Articles-and-Resources/How-Symlinks-boost-productivity/ta-p/126258


Hope this helps, if not then one of our powershell expert will come back to you.

NeedHelp
8,813 Views

Hi,

We saw this article.
But that does not correspond to the need. We try to create a symlink to a file by mounting a CIFS folder.
The New-NcSymlink command only needs two parameters: Symlink and Path.
when we return this command we have an error "No such file or Directory". This creates a file but does not point to anything.
Is it a problem configuring the netAPP cluster or the Powershell version 9.6 toolkit?

Can you give an example of a command to test?

 

Thank

Ontapforrum
8,661 Views

Hi,

 

I followed this KB article, and it worked perfectly in my lab. Screenshot attached.

 

How to create a symbolic link in clustered Data ONTAP without the need for NFS:
https://kb.netapp.com/app/answers/answer_view/a_id/1029854


Lab:
simulator:ONTAP 9.6

PSversion:4

 

Note: Original & symlink file need not exist prior, first will be created during command-line execution, and test_copy will be created automatically.
symlink: test_copy
original: test

NeedHelp
8,641 Views
Thank you for your time.
I do not understand. If Original and symlink file does not exist how can you create a symlink to an existing file?
I also tested :
   - My vServer : BISPNASN4003
   - My ShareName: VDISK1
I try to create a symlink file "Symlink.txt" that  point to "Target.txt"  :
  - First command
   Add-NcCifsSymlink –unixpath /Target.txt/ -cifspath /Symlink.txt/ -locality local –sharename VDISK1
  - Second command
   New-NcSymlink –target /Target.txt –linkname /vol/BISPNASN4003_01/VDISK1/Symlink.txt
II do not see a file "Target.txt"
 
 
 
 

Ontapforrum
8,625 Views

My wording may have confused you. But, what I'm  trying to say is, I created a file 'test' and sym linked to  'test_copy' which is actually a symlink created by the first command. Target  is simply does not have to exist.

 
Its mentioned in the article : The '-target is a path or location that does not have to exist. The target path is not checked for validity.
 
'Test' will create a symlink that points to a non-existent path of /somewhere 
 and the symbolic link itself will be created in the shared folder, in my case qtree_cifs.
 
 
I have tried it 3 times, and it worked for me.

NeedHelp
8,532 Views

OK, thanks. I understood. The first command creates a symlink object that points to the target. The second command creates the file that points to the created symlink.

Super.

thank for your time and your Help

Ontapforrum
8,514 Views

Yes,  you worded perfectly. Thanks!

Public