Adding permission for creating SymLink using PowerShell



Today’s post will be about very interesting thing, named SymLink. What Wikipedia says about it:

In computing, a symbolic link (also symlink or soft link) is the nickname for any file that contains a reference to another file or directory in the form of an absolute or relative path and that affects pathname resolution

It could be a very useful things in different scenarios.

So, how you could create SymLink in Windows? Here an example:

But for creating SymLinks you should have permissions. If you use can window way it’s simple:

  1. Open the Local Group Policy Editor ( )
  2. Edit the Create symbolic links policy at:Computer configuration → Windows Settings → Security Settings → Local Policies → User Rights Assignment → Create symbolic links

But if you need to use console way (for example, automatic deploy or similar) it could be a bit complicated. We will use PowerShell to achieve that.

So, here a script that allows us to do that:

If in two words, the main process could be divided in two steps:

The first one is to load existing Local Security Policy configuration using secedit.exe to the temporary file to check if already have needed permissions:

And if need to add them, we should create another temporary file with new settings and import it:

That’s it 🙂

Thanks for your attention! 🙂


Leave a Reply