Skip to content

Powershell Tuesday Quick Tip #6

This week’s tip is a bit longer – it’s actually a little script to remotely create a shortcut to a network file share on a user’s desktop. This one comes in handy when explaining how to make a shortcut over the phone proves …. difficult.

$PC = ''
$User = 'LSkywalker'
$TargetPath = "\\\death_star_plans\"
$ShortcutFile="\\$PC\C$\Users\$user\Desktop\Death Star.lnk"
$Obj = New-Object -COMObject Wscript.Shell
$Shortcut = $Obj.CreateShortcut($ShortcutFile)
$Shortcut.TargetPath = $TargetPath

This one is a good candidate for getting wrapped up in a function and added to an “Admin Toolkit Module”.

Leave a Reply

%d bloggers like this:
Verified by MonsterInsights