Compare commits

..
3 Commits
Author SHA1 Message Date
dyoder 8714ddb213 added Remove-File function 2021-10-08 05:42:05 -04:00
dyoder 98571828d8 delete desktop icon after install 2021-10-08 05:41:49 -04:00
dyoder 087516fde3 moved Delete-File function to Tools.ps1
removed global variable
2021-10-08 05:40:58 -04:00
3 changed files with 21 additions and 21 deletions
-17
View File
@@ -1,25 +1,8 @@
$Global:_FixAteraAgentRestartAgent = $false
Function Delete-File ([Parameter(ValueFromPipeline=$true)][string]$path) {
If ( Test-Path $path ) {
If ( !((Get-Item $path) -is [System.IO.DirectoryInfo]) ) {
$Global:_FixAteraAgentRestartAgent = $true
Try {
LogMsg "Delete ""${path}"""
Remove-Item $path -Force
}
Catch { LogErr $_.Exception.Message }
}
}
}
## Remove cached files related to thresholds and alerts ## Remove cached files related to thresholds and alerts
"${Env:PROGRAMFILES}\ATERA Networks\AteraAgent\Packages\AgentPackageMonitoring\AlertsCache.cch", "${Env:PROGRAMFILES}\ATERA Networks\AteraAgent\Packages\AgentPackageMonitoring\AlertsCache.cch",
"${Env:PROGRAMFILES}\ATERA Networks\AteraAgent\Packages\AgentPackageMonitoring\AlertsSentCache.cch", "${Env:PROGRAMFILES}\ATERA Networks\AteraAgent\Packages\AgentPackageMonitoring\AlertsSentCache.cch",
"${Env:PROGRAMFILES}\ATERA Networks\AteraAgent\Packages\AgentPackageMonitoring\config.json" | Delete-File "${Env:PROGRAMFILES}\ATERA Networks\AteraAgent\Packages\AgentPackageMonitoring\config.json" | Delete-File
If ($Global:_FixAteraAgentRestartAgent) {
LogMsg "Restarting Atera Agent service" LogMsg "Restarting Atera Agent service"
Try { Control-Service -Restart -Name "AteraAgent" -Force } Try { Control-Service -Restart -Name "AteraAgent" -Force }
Catch { LogErr $_.Exception.Message } Catch { LogErr $_.Exception.Message }
}
+4
View File
@@ -44,3 +44,7 @@ Catch { LogErr $_.Exception.Message }
LogMsg "Setting Emberkom Cloud Backup agent edition to ""$AgentEdition""" LogMsg "Setting Emberkom Cloud Backup agent edition to ""$AgentEdition"""
Try { Set-MBSAgentSetting -Edition $AgentEdition -Verbose } Try { Set-MBSAgentSetting -Edition $AgentEdition -Verbose }
Catch { LogErr $_.Exception.Message } Catch { LogErr $_.Exception.Message }
## Delete the desktop icon
"${Env:PUBLIC}\Desktop\Emberkom Backup.LNK",
"${Env:PUBLIC}\Desktop\Emberkom Cloud Backup.LNK" | Remove-File
+13
View File
@@ -512,5 +512,18 @@ function Install-MSP360Module {
Catch { LogErr $_.Exception.Message } Catch { LogErr $_.Exception.Message }
} }
# Function to delete a file
function Remove-File ([Parameter(ValueFromPipeline=$true)][string]$path) {
If ( Test-Path $path ) {
If ( !((Get-Item $path) -is [System.IO.DirectoryInfo]) ) {
Try {
LogMsg "Delete ""${path}"""
Remove-Item $path -Force
}
Catch { LogErr $_.Exception.Message }
}
}
}
Setup-MSPDirectories Setup-MSPDirectories
Setup-LogFile Setup-LogFile