-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
27 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
cloudscripts/Microsoft Teams/Create-TeamsDesktopShortcut.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Set the Microsoft Teams directory path | ||
$teamsDir = "C:\Program Files\WindowsApps\MSTeams_*" | ||
|
||
# Check if the Microsoft Teams directory exists | ||
if (Test-Path $teamsDir) { | ||
Write-Host -ForegroundColor Green "[+] New Microsoft Teams already installed" | ||
|
||
# Create a shortcut on the All Users Desktop | ||
$allUsersDesktopPath = "C:\Users\Public\Desktop" | ||
$shortcutPath = Join-Path -Path $allUsersDesktopPath -ChildPath "Microsoft Teams.lnk" | ||
$targetPath = (Get-Item -Path $teamsDir).FullName + "\Teams.exe" | ||
|
||
if (Test-Path $targetPath) { | ||
$shell = New-Object -ComObject WScript.Shell | ||
$shortcut = $shell.CreateShortcut($shortcutPath) | ||
$shortcut.TargetPath = $targetPath | ||
$shortcut.IconLocation = $targetPath | ||
$shortcut.Save() | ||
Write-Host -ForegroundColor Green "[+] Microsoft Teams shortcut created on All Users Desktop." | ||
} else { | ||
Write-Host -ForegroundColor Yellow "[-] Teams executable not found. Shortcut was not created." | ||
} | ||
|
||
Exit | ||
} else { | ||
Write-Host -ForegroundColor Yellow "[-] New Microsoft Teams is not installed." | ||
} |