This function allows you to create a symbolic link for either a directory or a file using PowerShell. This does not use mklink.exe, which is an internal command available with cmd.exe and instead uses pinvoke to call Win32 APIs to handle the symbolic link creation.Updated 23 Ju

4.3 Star
8,140 times
Add to favorites
E-mail Twitter Digg Facebook
Sign in to ask a question

  • new-symlink for shadow copies
    1 Posts | Last post February 01, 2017
    • I had to remove the validation of path to successfully create the symbolic link of a shadow copy. 
      test-path seems to be useless to check this type of paths:
  • NFS Mapped Drive Support?
    2 Posts | Last post January 08, 2016
    • Hi Boe,
      I finally understand what parameter sets are all about. Thanks. Anyway, do you know if this “should” support mapped drives? Specifically an NFS mount (using NFS-Client feature on Server 2012 R2)? Currently, I’m getting the error “WARNING: N:\: Unable to create symbolic link!”. N:\ is the mapped drive.
    • Yes it does. I had created the $SymPath. This line does it and if it exists, returns false. [mklink.symlink]::CreateSymbolicLink($SymName,$Path,$Flag[$PScmdlet.ParameterSetName])
  • Does nothing
    2 Posts | Last post May 20, 2015
    • Hi there, 
      I know I'm a couple years late, but I tried this script, and it does nothing. 
      I have a directory, dir1 in c:\testdir, and I wanted to try and make a symlink, c:\testdir\dir_symlink. I use this syntax: 
      New-SymLink.ps1 -Path c:\testdir\dir1 -SymPath c:\testdir\dir_symlink -Directory
      It doesn't throw an error, but it also doesn't do anything; there's no symlink created. 
      Am I missing something? 
    • Nevermind, I'm a doofus. I needed to import the module first!