Skip to content

Instantly share code, notes, and snippets.

@phosphore
Created October 28, 2018 23:14
Show Gist options
  • Save phosphore/1abb95a1c32d720a191decfb2ea8fda6 to your computer and use it in GitHub Desktop.
Save phosphore/1abb95a1c32d720a191decfb2ea8fda6 to your computer and use it in GitHub Desktop.
# Determine where to do the logging
$tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
$logPath = $tsenv.Value("LogPath")
$logFile = "$logPath\$($myInvocation.MyCommand).log"
# Start the logging
Start-Transcript $logFile
Write-Host "Logging to $logFile"
# Main code
$Shell = New-Object -ComObject ("WScript.Shell")
$ShortCut = $Shell.CreateShortcut("C:\Users\Default\Desktop\Shortcut.lnk")
$ShortCut.TargetPath="https://www.google.com"
$ShortCut.WindowStyle = 1;
$ShortCut.IconLocation = "C:\Program Files\internet explorer\iexplore.exe, 0";
$ShortCut.Description = "Shortcut Description";
$ShortCut.Save()
# Stop logging
Stop-Transcript
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment