Posted August 9, 20205 yr Great for onboarding new station, you can grab any other short cuts such as to shared rive, or network folders, the users C drive or the my documents folder as well, I just did the office apps. #By eDcisions $Officepath = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe\Path") $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Excel.lnk") $Shortcut.TargetPath = "$Officepath\Excel.exe" $Shortcut.Save() $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Outlook.lnk") $Shortcut.TargetPath = "$Officepath\Outlook.exe" $Shortcut.Save() $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Word.lnk") $Shortcut.TargetPath = "$Officepath\Winword.exe" $Shortcut.Save()
August 10, 20205 yr Author Darn, missed the fact that I was in session 0, ooops my bad, this should add to all active users. $Officepath = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe\Path") $Profiles = Get-ChildItem 'HKLM:\Software\Microsoft\Windows NT\CurrentVersion\ProfileList' | ForEach-Object { $_.GetValue('ProfileImagePath') } foreach ($profile in $profiles -match "Users" -notmatch "spfarm" -notmatch "spsearch" -notmatch "TEMP" -notmatch "Classic"){ $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$Profile\Desktop\Excel.lnk") $Shortcut.TargetPath = "$Officepath\Excel.exe" $Shortcut.Save() $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$Profile\Desktop\Outlook.lnk") $Shortcut.TargetPath = "$Officepath\Outlook.exe" $Shortcut.Save() $WshShell = New-Object -comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut("$Profile\Desktop\Word.lnk") $Shortcut.TargetPath = "$Officepath\Winword.exe" $Shortcut.Save() }
August 12, 20205 yr Author I used a few times now and its about 90%, about 10% of the time my script fails to find the program, if anyone has any thoughts on what I missed please share.
September 12, 20213 yr About a year late here, but I would advise only worrying about the Public Desktop as this will impact all users who use the workstation. C:\users\public\public desktop\
Great for onboarding new station, you can grab any other short cuts such as to shared rive, or network folders, the users C drive or the my documents folder as well, I just did the office apps.
#By eDcisions
$Officepath = (New-Object -ComObject WScript.Shell).RegRead("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\Winword.exe\Path")
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Excel.lnk")
$Shortcut.TargetPath = "$Officepath\Excel.exe"
$Shortcut.Save()
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Outlook.lnk")
$Shortcut.TargetPath = "$Officepath\Outlook.exe"
$Shortcut.Save()
$WshShell = New-Object -comObject WScript.Shell
$Shortcut = $WshShell.CreateShortcut("$Home\Desktop\Word.lnk")
$Shortcut.TargetPath = "$Officepath\Winword.exe"
$Shortcut.Save()