From c08383272d4cc90c9af7501ba48f0066411eb029 Mon Sep 17 00:00:00 2001 From: dyoder Date: Wed, 18 Nov 2020 16:42:34 -0500 Subject: [PATCH] add Genetec dump files to cleanup script copy AMP to Install-EmberkomBackup script --- Cleanup-SystemTempFiles.ps1 | 9 +++++++++ Install-EmberkomBackup.ps1 | 31 ++++++++++++++++++++++++++++++- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/Cleanup-SystemTempFiles.ps1 b/Cleanup-SystemTempFiles.ps1 index 8f316bb..fa93bef 100644 --- a/Cleanup-SystemTempFiles.ps1 +++ b/Cleanup-SystemTempFiles.ps1 @@ -52,6 +52,15 @@ If ( IsAdmin ) Try { Start-Process "powercfg" -ArgumentList "-h off" -Wait } Catch { LogErr $_.Exception.Message } } + + ## Remove Genetec application crash dumps + $GenetecCrashDumps = Get-ChildItem -Path "${Env:ProgramData}\Genetec\Dumps" | Where { $_.Name -match "^.*_Crash$" } + If ( $GenetecCrashDumps ) + { + LogMsg "Deleting Genetec application crash dumps" + Try { ForEach ( $dump in $GenetecCrashDumps ) { Remove-Item $dump -Force -Recurse -ErrorAction SilentlyContinue } } + Catch { LogErr $_.Exception.Message } + } } ## Only run this section if we don't have administrative privileges diff --git a/Install-EmberkomBackup.ps1 b/Install-EmberkomBackup.ps1 index 68f37a2..4f489c9 100644 --- a/Install-EmberkomBackup.ps1 +++ b/Install-EmberkomBackup.ps1 @@ -1,3 +1,32 @@ ### # This script exists in N-Central's Automation Manager -### \ No newline at end of file +### + +param( + [string]$ShortName = "EK", + [string]$LongName = "Emberkom", + [string]$NotificationEmail = "notification@emberkom.com" +) + +Function source { . 'C:\Users\dyoder\Emberkom\Data\Projects\development\management-scripts\Tools.ps1' } +source + +## Because the N-Central Automation Manager can't actually read the full Powershell syntax, we have to first put the passed in variables +## into new variables so we can reference the RMM generated data in the standard form and not with the curly braces +$short = $ShortName +$long = $LongName +$email = $NotificationEmail + +$account = "${short}_${Env:COMPUTERNAME}".ToUpper() +$email = $email.ToLower() + +## URL to download the branded WholesaleBackup installer +$URL = "http://downloads.backupops.com/4Windows/${MSPName}Backup_installer.exe" + +## Silent installation options +$Arguments = "/SP- /VERYSILENT /NORESTART /WPUSH /WACCOUNT ""${account}"" /WORG ""${long}"" /WEMAIL ""${email}""" + +## Install Emberkom Backup +#Install-Program -Path $(Download-File -URL $URL) -Arguments $Arguments -Delete + +Write-Output $Arguments \ No newline at end of file