Greg Altman

IT Leader, Writer, Speaker

Menu
  • Home
  • Speaking
  • About Me
  • Reviews
Menu

Powershell Tuesday Quick Tip #6

Posted on April 10, 2018 by Greg Altman

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.

[code lang=’powershell’]
$PC = ‘Luke-Laptop.rebellion.org’
$User = ‘LSkywalker’
$TargetPath = “\\tactics.rebellion.org\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
$Shortcut.Save()
[/code]

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

Share this:

  • Click to share on Bluesky (Opens in new window) Bluesky
  • Click to email a link to a friend (Opens in new window) Email

Like this:

Like Loading...

Related

Category: PowerShell

Categories

  • Ad-hoc and Random
  • Blog
  • Career
  • Cloud
  • Events
  • PowerShell
  • Reviews
  • Server Stuff
  • Troubleshooting
  • Uncategorized
Share on X

© 2025 Greg Altman | Powered by Minimalist Blog WordPress Theme
%d