Public/New-P1ManagerShortcut.ps1
function New-P1ManagerShortcut { <# .Synopsis Creates a desktop shortcut to PlannerOne Manager, for a given tenant. .Description Creates a shortcut on the desktop. .Parameter Tenant The tenant name. .Example # Creates a PlannerOne Manager shortcut for tenant named Demo. New-P1Tenant -Tenant Demo #> [cmdletbinding()] param( [Parameter(Mandatory=$true)] [string] $Tenant ) Process { if (!(Test-Tenant $Tenant)) { Write-Warning "Tenant $Tenant does not exist." Write-Warning "Operation canceled." return; } # get bin path for the tenant $servicePath = Get-ServicePath $managerPath = "$servicePath\$Tenant\PlannerOneManager.exe" $ShortcutFile = "$env:Public\Desktop\PlannerOne Manager - $Tenant.lnk" $WScriptShell = New-Object -ComObject WScript.Shell $Shortcut = $WScriptShell.CreateShortcut($ShortcutFile) $Shortcut.TargetPath = $managerPath $Shortcut.Save() } } |