1+ :# ------------------------------------------
2+ # File : System-Functions.ps1
3+ # Author: Jimmy Briggs
4+ # Title : System Functions
5+ # ------------------------------------------
6+
7+ # Check Disk
8+ Function Invoke-Checkdisk { & chkdsk C: / f / r / x }
9+
10+ # Optional Features
11+ Function Get-OptionalFeatures { & Get-WindowsCapability - Online | Where-Object { $_.State -eq ' Installed' } }
12+
13+ # SFC Scan
14+ Function Invoke-SFCScan { & sfc / scannow }
15+
16+ # Admin
17+ Function Test-Admin {
18+ if (! (Verify- Elevated)) {
19+ $newProcess = new-object System.Diagnostics.ProcessStartInfo " PowerShell" ;
20+ $newProcess.Arguments = $myInvocation.MyCommand.Definition ;
21+ $newProcess.Verb = " runas" ;
22+ [System.Diagnostics.Process ]::Start($newProcess );
23+ exit
24+ }
25+ }
26+
27+ # Updates
28+ Function Update-Npm { & npm install npm@latest - g }
29+ Function Update-Pip { & python - m pip install -- upgrade pip }
30+ Function Update-Pwsh { & iex " & { $ ( irm https:// aka.ms/ install-powershell.ps1 ) } -UseMSI" }
31+ Function Update-Gcloud { & gcloud components update }
32+
33+ # MSStore
34+ Function Reset-MSStore { & wsreset.exe }
35+ Function Reset-StoreApps {
36+ Get-AppxPackage - allusers | foreach {Add-AppxPackage - register " $ ( $_.InstallLocation ) \appxmanifest.xml" - DisableDevelopmentMode}
37+ }
38+
39+ # Drivers
40+ Function Get-Drivers { & dism / online / get-drivers / format:table }
41+
42+ # Cleanup
43+ Function Invoke-DiskCleanup { & sudo cleanmgr.exe }
44+ Function Invoke-DiskCleanupAdvanced { & cmd.exe / c Cleanmgr / sageset:65535 & Cleanmgr / sagerun:65535 }
45+
46+ # winSAT
47+ Function Invoke-WinSAT { & winSAT formal - restart }
48+ Function Get-WinSATReport { & Get-CimInstance Win32_WinSat }
49+
50+ # Virus Scanning
51+ Function Invoke-VirusScan { & cmd.exe " %ProgramFiles%\Windows Defender\MpCmdRun.exe" - Scan - ScanType 1 }
52+ Function Invoke-VirusScanFull { & start-mpscan - scantype fullscan }
53+
54+ # Repair Image
55+ Function Repair-WinImage {
56+ Dism.exe / Online / Cleanup- Image / ScanHealth
57+ Dism.exe / Online / Cleanup- Image / RestoreHealth
58+ Dism.exe / online / Cleanup- Image / StartComponentCleanup
59+ }
60+
61+ # NOTE: pwsh syntax: # Function Repair-WinImage { Repair-WindowsImage -Online -ScanHealth }
62+
63+ Function Invoke-MemoryDiagnostic { & mdsched.exe }
64+
65+ Function Create-NetReport { & netsh wlan show wlanreport }
66+
67+ # Windows Updates
68+ Function Reset-WUComponents {
69+ net stop bits
70+ net stop wuavserv
71+ net stop appidsvc
72+ net stop cryptsvc
73+ ipconfig / flushdns
74+ del / s / q / f " %ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
75+ del / s / q / f " %SYSTEMROOT%\Logs\WindowsUpdate\*"
76+ net start bits
77+ net start weavserv
78+ net start appidsvc
79+ net start cryptsvc
80+ $restart = Read-Host " Restart?"
81+ if ($restart -eq " y" ) { Restart-Computer }
82+ }
0 commit comments