Skip to content

Commit

Permalink
Teams shortcut script
Browse files Browse the repository at this point in the history
  • Loading branch information
1eyeITguy committed Dec 23, 2024
1 parent a673d0a commit 63a874d
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions cloudscripts/Microsoft Teams/Create-TeamsDesktopShortcut.ps1
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."
}

0 comments on commit 63a874d

Please sign in to comment.