How to create a network shortcut with Powershell : The easy way

After much searching, came across this and modified it a bit.

This code will create a network shortcut to desktop and name it “Shared”. Works on other language OS aswell.

And its just simple.

$shortcut = New-Object -ComObject WScript.Shell
$desktop = [System.Environment]::GetFolderPath(‘Desktop’)
$lnk = $shortcut.CreateShortcut($desktop+”\Shared.lnk”)
$lnk.TargetPath = “\\UNCPATH\Share”
$lnk.Save()