wbMSPmodule.psm1
<#PSScriptInfo .VERSION 1.0 .GUID 52945996-1255-4333-8f09-c5e2bca3b715 .AUTHOR WadeBach22 .COMPANYNAME .COPYRIGHT .TAGS .LICENSEURI .PROJECTURI .ICONURI .EXTERNALMODULEDEPENDENCIES .REQUIREDSCRIPTS .EXTERNALSCRIPTDEPENDENCIES .RELEASENOTES #> <# .DESCRIPTION The new MSP module from Wade Bachelder #> Param() function fireWallOn { NetSh Advfirewall set allprofiles state on; } function fireWallOff { NetSh Advfirewall set allprofiles state off; } function setPowerState { Powercfg.exe /h off; Powercfg /x -disk-timeout-ac 0; Powercfg /x -disk-timeout-dc 0; Powercfg /x -monitor-timeout-ac 30; Powercfg /x -monitor-timeout-dc 30; Powercfg /x -standby-timeout-ac 0; Powercfg /x -standby-timeout-dc 0; Powercfg /x -hibernate-timeout-ac 0; Powercfg /x -hibernate-timeout-dc 0; } function showMemoryProcesses { Get-Process | Sort-Object -Descending WS } function setLaptopPower { Powercfg -setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0; Powercfg -setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0 } function setRegistry { Try{New-ItemProperty -ErrorAction Stop -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -PropertyType DWORD -Name 'EnableLinkedConnections' -Value 1;} Catch{Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System" -Name 'EnableLinkedConnections' -Value 1;} Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -name "fDenyTSConnections" -value 0; New-Item -Path "HKLM:\SOFTWARE\Microsoft\Office\16.0\Common\Open Find\" -Force | Out-Null; Try{New-ItemProperty -ErrorAction Stop -Path "HKLM:\SOFTWARE\Microsoft\Office\16.0\Common\Open Find\" -PropertyType DWORD -Name 'EnableShellDataCaching' -Value 1;} Catch{Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Office\16.0\Common\Open Find\" -Name 'EnableShellDataCaching' -Value 1;} } function checkHDHealth { Get-PhysicalDisk; } function optimizeHD { Optimize-Volume -DriveLetter C -Defrag -Verbose; } function repairHD { Repair-Volume -DriveLetter C -OfflineScanAndFix; } function sophosUpdateScan { $process = Get-Process -Id $pid; $process.PriorityClass = 'BelowNormal'; $sophos = New-Object -ComObject "activelinkclient.clientupdate.1" $sophos.updatenow($true,1) $Sophos = "C:\Program Files (x86)\Sophos\Sophos Anti-Virus\sav32cli.exe" $Arguments = "-remove" Start-Process $Sophos -ArgumentList $Arguments -NoNewWindow -Wait } function windowsStabilityIndex { Get-Ciminstance Win32_ReliabilityStabilityMetrics | Measure-Object -Average -Maximum -Minimum -Property systemStabilityIndex } function windowsCounters { Get-Counter; } function listTop10Files { $process = Get-Process -Id $pid; $process.PriorityClass = 'BelowNormal'; Get-ChildItem c:\ -r| sort -descending -property length | select -first 10 name, Length } function networkDiscoveryOn { Netsh advfirewall firewall set rule group="Network Discovery" new enable=Yes; } function fileDiscoveryOn { Netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=Yes; } function renameWorkstation { $NewSerialNumber = (gwmi win32_bios).SerialNumber; Rename-computer -NewName $NewSerialNumber -force; } function GeneralDiskCleanUp { Get-ChildItem "C:\Windows\SoftwareDistribution\*" -Recurse -Force -verbose -ErrorAction SilentlyContinue | Remove-Item -Force -Verbose -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Windows\prefetch\*" -Recurse -Force -verbose -ErrorAction SilentlyContinue | Remove-Item -Force -Verbose -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Users\*\AppData\Local\Temp\*" -Recurse -Force -verbose -ErrorAction SilentlyContinue | Remove-Item -Force -Verbose -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\*" -Recurse -Force -verbose -ErrorAction SilentlyContinue | Remove-Item -Force -Verbose -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Windows\system32\wbem\Logs\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Windows\system32\Logfiles\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Windows\Debug\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Windows\Downloaded Program Files\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Windows\LiveKernelReports\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.MSO\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Word\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\Low\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.Outlook\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\Content.IE5\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Users\*\AppData\Roaming\Microsoft\Internet Explorer\UserData\Low\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\WER\ERC\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Users\*\AppData\Local\Microsoft\Windows\INetCache\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Users\*\AppData\Local\Google\Chrome\User Data\Default\Cache\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Windows.old\*" -Recurse -Force -verbose -ErrorAction SilentlyContinue | Remove-Item -Force -Verbose -Recurse -ErrorAction SilentlyContinue; Get-ChildItem "C:\Windows10Upgrade\*" -Recurse -Force -verbose -ErrorAction SilentlyContinue | Remove-Item -Force -Verbose -Recurse -ErrorAction SilentlyContinue; Get-ChildItem 'C:\$Recycle.Bin\*' -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; get-psdrive -psprovider filesystem; } function PackageCleanUp { Get-ChildItem "C:\Users\*\AppData\Local\Packages\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; get-psdrive -psprovider filesystem; } function TEAMSCleanUp { Get-ChildItem "C:\Users\*\AppData\Roaming\Microsoft\Teams\*" -Force | Remove-Item -Recurse -ErrorAction SilentlyContinue; get-psdrive -psprovider filesystem; } |