0

i was inquiring if there are options to create a url shortcut to be placed on c:\users\username\favorites to be applied to be added to the login script of the user on Active directory to create the favorites for any user i tried searching all over the internet and i only found "MD" and "MKDir" commands

MoustafaBorhan
  • 23
  • 1
  • 3
  • 8
  • possible duplicate of [How to create a shortcut using Powershell](http://stackoverflow.com/questions/9701840/how-to-create-a-shortcut-using-powershell). Pretty sure it is no different. Just use your URL as the target and add a URL extension. – Matt Apr 06 '15 at 11:05

1 Answers1

3

Not the most PowerShell answer but this is the widely used one with the best compatibility in versions. Much like this answer but small changes for URLs

$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\Favorites\Google.url")
$Shortcut.TargetPath = "http://www.google.ca"
$Shortcut.Save()

This will make a shortcut to Google in your favorites. $Home being one of PowerShell's Automatic Variables

If you happen to have PowerShell 5.0 it can now do this natively. Again refer to this answer for more information

Matt
  • 45,022
  • 8
  • 78
  • 119