diff --git a/Create-Shortcut.ps1 b/Create-Shortcut.ps1 new file mode 100644 index 0000000..3948666 --- /dev/null +++ b/Create-Shortcut.ps1 @@ -0,0 +1,29 @@ +<# +.Synopsis +Creates a Desktop shortcut for launching Exchange Recipient Admin Center. +.Description +Run this once from wherever this project's files actually live. It resolves +its own folder and the current user's Desktop dynamically, so the same +script works unmodified for any user/location - no hardcoded paths. +#> + +$targetFolder = Split-Path -Parent $MyInvocation.MyCommand.Path +$batPath = Join-Path $targetFolder "Launch-ExchangeRecipientAdmin.bat" +$iconPath = Join-Path $targetFolder "images\favicon.ico" +$desktop = [Environment]::GetFolderPath('Desktop') +$shortcutPath = Join-Path $desktop "Exchange Recipient Admin Center.lnk" + +$shell = New-Object -ComObject WScript.Shell +$shortcut = $shell.CreateShortcut($shortcutPath) +$shortcut.TargetPath = $batPath +$shortcut.WorkingDirectory = $targetFolder +if (Test-Path $iconPath) { + $shortcut.IconLocation = $iconPath +} +else { + $shortcut.IconLocation = "$env:SystemRoot\System32\WindowsPowerShell\v1.0\powershell.exe,0" +} +$shortcut.Description = "Exchange Recipient Admin Center" +$shortcut.Save() + +Write-Host "Shortcut created at: $shortcutPath" diff --git a/Launch-ExchangeRecipientAdmin.bat b/Launch-ExchangeRecipientAdmin.bat new file mode 100644 index 0000000..2bd8882 --- /dev/null +++ b/Launch-ExchangeRecipientAdmin.bat @@ -0,0 +1,2 @@ +@echo off +powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "Start-Process powershell.exe -Verb RunAs -ArgumentList '-ExecutionPolicy Bypass -File \"%~dp0Start-ExchangeRecipientAdminCenter.ps1\"'" diff --git a/Start-ExchangeRecipientAdminCenter.ps1 b/Start-ExchangeRecipientAdminCenter.ps1 index 9955ee4..86deeda 100644 --- a/Start-ExchangeRecipientAdminCenter.ps1 +++ b/Start-ExchangeRecipientAdminCenter.ps1 @@ -35,6 +35,135 @@ $MIMEHASH = @{".avi" = "video/x-msvideo"; ".crt" = "application/x-x509-ca-cert"; $HTML_SUCCESS = "