From 08fb56746018d4a0e8ca19f05de1750cbcce67f0 Mon Sep 17 00:00:00 2001 From: dyoder Date: Wed, 2 Jun 2021 16:16:24 -0400 Subject: [PATCH] bunch of fixes and updates --- Fix-SplashtopService.ps1 | 1 + Fix-SystemPrintQueue.ps1 | 23 ++++++++++++------- Set-EventLogs.ps1 | 7 ++++++ Tools.ps1 | 4 ++-- ...erCloud.ps1 => Uninstall-CCleanerCloud.ps1 | 0 rmm/Fix-SplashtopService.ps1 | 2 +- rmm/Set-EventLogs.ps1 | 2 ++ 7 files changed, 28 insertions(+), 11 deletions(-) create mode 100644 Fix-SplashtopService.ps1 create mode 100644 Set-EventLogs.ps1 rename Uninstall-CCeanerCloud.ps1 => Uninstall-CCleanerCloud.ps1 (100%) create mode 100644 rmm/Set-EventLogs.ps1 diff --git a/Fix-SplashtopService.ps1 b/Fix-SplashtopService.ps1 new file mode 100644 index 0000000..6515338 --- /dev/null +++ b/Fix-SplashtopService.ps1 @@ -0,0 +1 @@ +Control-Service -Restart -Name 'SplashtopRemoteService' \ No newline at end of file diff --git a/Fix-SystemPrintQueue.ps1 b/Fix-SystemPrintQueue.ps1 index 9e4a419..8bb6310 100644 --- a/Fix-SystemPrintQueue.ps1 +++ b/Fix-SystemPrintQueue.ps1 @@ -1,10 +1,17 @@ -## Stop the spooler service -Control-Service -Stop -Name 'spooler' +$SERVICE = 'spooler' -## Delete all print jobs -LogMsg "Deleting all print jobs from ""${Env:WINDIR}\System32\spool\PRINTERS""" -Try { Remove-Item "${Env:WINDIR}\System32\spool\PRINTERS\*" -Recurse } -Catch { LogErr $_.Exception.Message } +## Make sure the service isn't disabled +If (! ($(Get-Service -Name 'spooler').StartType -eq "Disabled") ) { -## Start the spooler service -Control-Service -Start -Name 'spooler' + ## Stop the spooler service + Control-Service -Stop -Name $SERVICE + + ## Delete all print jobs + LogMsg "Deleting all print jobs from ""${Env:WINDIR}\System32\spool\PRINTERS""" + Try { Remove-Item "${Env:WINDIR}\System32\spool\PRINTERS\*" -Recurse } + Catch { LogErr $_.Exception.Message } + + ## Start the spooler service + Control-Service -Start -Name $SERVICE + +} diff --git a/Set-EventLogs.ps1 b/Set-EventLogs.ps1 new file mode 100644 index 0000000..86eee01 --- /dev/null +++ b/Set-EventLogs.ps1 @@ -0,0 +1,7 @@ +$LogsToEnable = @( + +) + +ForEach ( $log in $LogsToEnable ) { + Toggle-Log -Name $log -Enable +} diff --git a/Tools.ps1 b/Tools.ps1 index d983ddf..601181c 100644 --- a/Tools.ps1 +++ b/Tools.ps1 @@ -443,8 +443,8 @@ function Toggle-Log { ) Try { $log = New-Object System.Diagnostics.Eventing.Reader.EventLogConfiguration $Name - If ( $Enable ) { $log.IsEnabled = $true } - If ( $Disable ) { $log.IsEnabled = $false } + If ( $Enable ) { LogMsg "Enabing ${Name} event log" ; $log.IsEnabled = $true } + If ( $Disable ) { LogMsg "Disabing ${Name} event log" ; $log.IsEnabled = $false } $log.SaveChanges() } Catch { LogMsg $_.Exception.Message } diff --git a/Uninstall-CCeanerCloud.ps1 b/Uninstall-CCleanerCloud.ps1 similarity index 100% rename from Uninstall-CCeanerCloud.ps1 rename to Uninstall-CCleanerCloud.ps1 diff --git a/rmm/Fix-SplashtopService.ps1 b/rmm/Fix-SplashtopService.ps1 index 6a0272b..35bccb5 100644 --- a/rmm/Fix-SplashtopService.ps1 +++ b/rmm/Fix-SplashtopService.ps1 @@ -1,2 +1,2 @@ . $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Tools.ps1'))) -Control-Service -Restart -Name 'SplashtopRemoteService' \ No newline at end of file +Run-Script -LivePSScript Fix-SplashtopService \ No newline at end of file diff --git a/rmm/Set-EventLogs.ps1 b/rmm/Set-EventLogs.ps1 new file mode 100644 index 0000000..4655806 --- /dev/null +++ b/rmm/Set-EventLogs.ps1 @@ -0,0 +1,2 @@ +. $([Scriptblock]::Create((New-Object Net.WebClient).DownloadString('https://dev.emberkom.com/emberkom/management-scripts/raw/branch/master/Tools.ps1'))) +Run-Script -LivePSScript Set-EventLogs \ No newline at end of file