Functions/Maintenance.ps1
function Maintenance { [CmdletBinding()] param ( [Parameter()] [switch] $UpdateAll, [Parameter()] [switch] $UpdatePSModules, [Parameter()] [switch] $UpdateHelp ) cua cr rdi Write-Host "`n----`n" Remove-DownloadFolderItems # Backup-MySettings -All # Set-ChocoPinList if (Get-Command Get-MpComputerStatus -ea 0) { $MpScan_Params = @{ AsJob = $true } if ((Get-MpComputerStatus).FullScanOverdue -eq $true) { $MpScan_Params.Add('ScanType', 'FullScan') } if ((Get-MpComputerStatus).QuickScanOverdue -eq $true -or (Get-MpComputerStatus).FullScanOverdue -eq $true) { Start-MpScan @MpScan_Params } } if ($UpdateAll -or $UpdatePSModules) { Start-Job -ScriptBlock { Update-InstalledModule Uninstall-OldInstalledModules } } if ($UpdateAll -or $UpdateHelp) { Start-Job -ScriptBlock { Update-Help -Force -ea 0 } } } |