From 4b84f790836d395fdd3a6c7b2e27f46852bdfc31 Mon Sep 17 00:00:00 2001 From: dyoder Date: Thu, 3 Dec 2020 20:18:23 -0500 Subject: [PATCH] remove unnecessary code from Install-DeltekVision.ps1 comment out Create-Shortcut from Install-Wireguard.ps1 fix some log messages in Tools.ps1 --- Install-DeltekVision.ps1 | 39 +++++++++------------------------------ Install-Wireguard.ps1 | 6 +++--- Tools.ps1 | 3 ++- 3 files changed, 14 insertions(+), 34 deletions(-) diff --git a/Install-DeltekVision.ps1 b/Install-DeltekVision.ps1 index b40221c..c695eab 100644 --- a/Install-DeltekVision.ps1 +++ b/Install-DeltekVision.ps1 @@ -1,35 +1,14 @@ -## Installation location for shortcut -$InstallLocation = "${Env:Public}\Desktop\Deltek Vision.lnk" - -## Remove the existing shortcut -If ( Test-Path $InstallLocation ) -{ - LogMsg "Deleting ""${InstallLocation}""" - Try { Remove-Item -Path $InstallLocation -Force } - Catch { LogErr $_.Exception.Message } -} - +. 'C:\Users\dyoder\Emberkom\Data\Projects\development\management-scripts\Tools.ps1' +$VisionURL = 'https://dbia.deltekfirst.com/DBIAClient/DeltekVision.application' ## Get the correct path to IE If ( Test-Path "${Env:ProgramFiles(x86)}" ) { $IEPATH = "${Env:ProgramFiles(x86)}\Internet Explorer\iexplore.exe" } Else { $IEPATH = "${Env:ProgramFiles(x86)}\Internet Explorer\iexplore.exe" } -If ( $VisionURL ) -{ +If ( $VisionURL ) { ## Make sure IE exists where we expect it to - If ( Test-Path $IEPATH ) - { - LogMsg "Creating shortcut at ""${InstallLocation}""" - Try - { - $WshShell = New-Object -ComObject WScript.Shell - $Shortcut = $WshShell.CreateShortcut($InstallLocation) - $Shortcut.Arguments = $VisionURL - $Shortcut.Description = "Launch Deltek Vision" - $Shortcut.IconLocation = "${IEPATH}, 0" - $Shortcut.WorkingDirectory = "$(Split-Path -Path $IEPATH -Parent)" - $Shortcut.TargetPath = "${IEPATH}" - $Shortcut.Save() - } - Catch { LogErr $_.Exception.Message } - } Else { LogMsg "Internet Explorer could not be found: ${IEPATH}" } -} Else { LogMsg "No URL to Deltek Vision was specified!" } + If ( Test-Path $IEPATH ) { + Create-Shortcut -Path "${Env:Public}\Desktop\Deltek Vision.lnk" -TargetPath $IEPATH -Arguments $VisionURL -Description "Launch Deltek Vision" + } + Else { LogMsg "Internet Explorer could not be found: ${IEPATH}" } +} +Else { LogMsg "No URL to Deltek Vision was specified!" } diff --git a/Install-Wireguard.ps1 b/Install-Wireguard.ps1 index 0157451..c08fbb2 100644 --- a/Install-Wireguard.ps1 +++ b/Install-Wireguard.ps1 @@ -13,8 +13,8 @@ If ( IsAdmin ) End-Process -Name "wireguard" -Match -Force ## Create shortcut on Public desktop - Create-Shortcut -Path "${Env:Public}\Desktop\WireGuard.LNK" -TargetPath "${Env:ProgramFiles}\WireGuard\wireguard.exe" -Description "WireGuard: Fast, Modern, Secure VPN Tunnel" + #Create-Shortcut -Path "${Env:Public}\Desktop\WireGuard.LNK" -TargetPath "${Env:ProgramFiles}\WireGuard\wireguard.exe" -Description "WireGuard: Fast, Modern, Secure VPN Tunnel" } - Else { LogMsg "The Wireguard installer was not downloaded properly" } + Else { LogMsg "The WireGuard installer was not downloaded properly" } } -Else { LogMsg "Must be an administrator to install Wireguard" } \ No newline at end of file +Else { LogMsg "Must be an administrator to install WireGuard" } \ No newline at end of file diff --git a/Tools.ps1 b/Tools.ps1 index 86ea874..b7b4e5c 100644 --- a/Tools.ps1 +++ b/Tools.ps1 @@ -420,8 +420,9 @@ Function Create-Shortcut { $Shortcut.IconLocation = $Icon $Shortcut.WorkingDirectory = $WorkingDirectory $Shortcut.TargetPath = $TargetPath + LogMsg "Creating shortcut to ""${TargetPath}"" at ""${Path}""" Try { $Shortcut.Save() } Catch { LogErr $_.Exception.Message } } - Else { LogMsg "The target path does not exist" } + Else { LogMsg "Cannot create shortcut because the target path does not exist" } } \ No newline at end of file