You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Displays detailed configuration information about the computer, including OS version, memory, and network adapters.
systeminfo
# Quickly checks the version of Windows you are running.
winver
################ bios get serialnumber Retrieves the serial number of the computer's BIOS. ###############
wmic bios get serialnumber
(Get-CimInstance Win32_ComputerSystemProduct).IdentifyingNumber
(Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion').DisplayVersion
################ Get system bios ###############
wmic bios get smbiosbiosversion
# Incognito Edge
Start-Process msedge -ArgumentList "-inprivate"# ###################################################################################################################
System File and Image Repair
# #################################################################################################################### System File Checker
sfc /scannow
# Scans all system files to detect and repair corrupted or missing files.
DISM /Online /Cleanup-Image /CheckHealth
# Quickly checks if there is any corruption in the system image.
DISM /Online /Cleanup-Image /ScanHealth
# Performs a detailed scan of the system image for corruption.
DISM /Online /Cleanup-Image /RestoreHealth
# Repairs detected corruption in the system image by downloading and replacing damaged files.
DISM /Online /Cleanup-Image /StartComponentCleanup
# Removes obsolete system files and outdated components from the Windows Component Store (WinSxS folder) to reclaim disk space, but it keeps backup components for uninstalling updates.
Dism.exe /Online /Cleanup-Image /AnalyzeComponentStore
################ Commands bundled ###############
Start-Process powershell -Verb RunAs -ArgumentList '-NoExit', '-Command', 'Write-Host "Starting: sfc /scannow"; sfc /scannow; Write-Host "Finished: sfc /scannow"; Write-Host "Starting: RestoreHealth"; dism /online /cleanup-image /RestoreHealth; Write-Host "Finished: RestoreHealth"; Write-Host "Starting: StartComponentCleanup"; dism /online /cleanup-image /StartComponentCleanup; Write-Host "Finished: StartComponentCleanup"'################ tail recent DISM entries###############
Get-Content -Path C:\Windows\Logs\DISM\dism.log -Tail 200
################ tail recent Component-Based Servicing log ###############
Get-Content -Path C:\Windows\Logs\CBS\CBS.log -Tail 200
shutdown /r /t 60 /c "Restart Initiated."
shutdown /r /t 3600 /c "System maintenance in progress. This device will restart automatically in 60 minutes."
Start-Process powershell -Verb RunAs -ArgumentList '-NoExit', '-Command', 'sfc /scannow'# ###################################################################################################################
SYSTEM PROCESSES / UP-TIME / GET TEMPERATURE AND OVERALL CPU USAGE
################ Uptime ###############$os=Get-CimInstance Win32_OperatingSystem; New-TimeSpan-Start $os.LastBootUpTime-End (Get-Date) | Select Days,Hours,Minutes
################ Get system Temperature ###############Get-WmiObject MSAcpi_ThermalZoneTemperature -Namespace root/wmi |Where-Object CurrentTemperature -gt0|Sort-Object CurrentTemperature -Descending |Select-Object-First 1|Select-Object InstanceName,@{Name='Fahrenheit'; Expression= { [math]::Round((($_.CurrentTemperature/10-273.15) *9/5) +32,1) } }
################ CPU / memory per process ###############Get-Process|Sort-Object CPU -Descending |Select-Object-First 10 Name, CPU, Id
################ Overall CPU usage ###############Get-Counter'\Processor(_Total)\% Processor Time'-SampleInterval 1-MaxSamples 5################ Kill MS sessions ###############"POWERPNT","EXCEL","WINWORD","OneDrive","OUTLOOK","ms-teams","Teams","msedge","chrome"|ForEach-Object { Get-Process-Name $_-ErrorAction SilentlyContinue |ForEach-Object { try { Stop-Process-Id $_.Id-Force -ErrorAction Stop; Write-Host"Terminated: $($_.Name) (PID $($_.Id))" } catch { Write-Host"Failed to terminate: $($_.Name) (PID $($_.Id))" } } }
################ Reliability Monitor ###############
perfmon /rel
# This diagnostic script checks the "health" of the PC to find hidden installation blockers: it verifies if the system is unstable (low reliability score), hasn't been rebooted in over a week, is waiting for a reboot (registry locks), has the Windows Installer service stuck, or has failed recent Windows Updates.
Write-Host "DIAGNOSTICS & BLOCKERS" -f Cyan; $s = (Get-CimInstance Win32_ReliabilityStabilityMetrics | select -f 1).SystemStabilityIndex; Write-Host "Stability (1-10): " -NoNewline; if ($s -lt 5) { Write-Host $s -f Red }else { Write-Host $s -f Green }; $d = ((Get-Date) - (Get-CimInstance Win32_OperatingSystem).LastBootUpTime).Days; Write-Host "Uptime: $d Days" -f $(if ($d -gt 7) { 'Yellow' }else { 'White' }); $p = @(); if (gp 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending' -ea 0) { $p += 'CBS' }; if (gp 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired' -ea 0) { $p += 'WU' }; if ((gp 'HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager' -ea 0).PendingFileRenameOperations) { $p += 'Rename' }; Write-Host "Reboot Pending: " -NoNewline; if ($p) { Write-Host "YES ($($p -join ','))" -f Red }else { Write-Host "NO" -f Green }; $m = (gps msiexec -ea 0); Write-Host "MSI Exec Busy: " -NoNewline; if ($m) { Write-Host "YES" -f Yellow }else { Write-Host "NO" -f Green }; Write-Host "`nLast 5 Updates:" -f Cyan; (New-Object -Com Microsoft.Update.Searcher).QueryHistory(0, 5) | % { Write-Host ("[{0}] {1}" -f $_.Date.ToString('MM-dd'), $_.Title.SubString(0, [math]::Min(45, $_.Title.Length))) -f $(if ($_.ResultCode -eq 2) { 'Green' }else { 'Red' }) }
# ###################################################################################################################
Disk and File System
# Checks the file system and disk for errors.
chkdsk /f; chkdsk /r
Use /f # to fix errors.
Use /r # to locate bad sectors and recover readable data.# Clean system files
cleanmgr
# Search for a text string in files
Select-String -Path "C:\logs\apps\.log" -Pattern'error'# Search for strings in files (More powerful, supports regex)
findstr /i /s /c:"password" C:\Users\*.txt # Case sensitive, search subdirs, literal string# To open an item "C:\".
Invoke-Item
# ###################################################################################################################
Clear Windows Update
net stop wuauserv
net stop bits
rd /s /q %windir%\SoftwareDistribution
net start wuauserv
net start bits
# Windows will immediately create a fresh, empty SoftwareDistribution folder. It forgets all downloaded update files and local history, forcing a full scan against the update server (Intune/WSUS) on the next cycle.$s = "wuauserv","bits","cryptsvc","dosvc"; Stop-Service $s -Force; Rename-Item -Path "$env:windir\SoftwareDistribution" -NewName "SoftwareDistribution.bak" -Force; Start-Service $s# ###################################################################################################################
Network Information
ipconfig /all # Shows detailed network configuration, including IP address, DNS, and MAC addresses.
netstat -an # # Displays active connections and listening ports.
ipconfig # Displays current network settings.
ipconfig /release # Releases the current IP address assigned to the device’s network adapter.
ipconfig /flushdns # Flushes the DNS cache to resolve DNS-related issues.
ipconfig /renew # Renews the IP address from the DHCP server.#Restart Required
netsh winsock reset # Resets the Winsock catalog to a clean state (fixes network stack issues).
netsh int ip reset # Resets TCP/IP settings to default (useful for network troubleshooting).# ###################################################################################################################
Group Policy and Intune Policies
gpupdate /force # Forces a refresh of Group Policy settings.
wmic qfe list # Lists all installed Windows updates (useful for checking patch status).
gpresult /h # List all the policies applied and security groups in HTML.
dsregcmd /status # Confirm the Device is Enrolled in Intune.
dsregcmd /refreshprt #Forces the device to immediately refresh its Primary Refresh Token (PRT) re-establishing authentication state# Force Windows device to immediately check in with Microsoft Intune and sync win32 apps and compliance
Get-ScheduledTask |? {$_.TaskName -eq 'PushLaunch'} | % { $_| Start-ScheduledTask; sleep 2;$_| Get-ScheduledTaskInfo |selectTaskName, Last* }
$Shell = New-Object -ComObject Shell.Application;$Shell.open("intunemanagementextension://syncapp")
$Shell = New-Object -ComObject Shell.Application;$Shell.open("intunemanagementextension://synccompliance")
Get-ScheduledTask |? {$_.TaskName -eq 'PushLaunch'} | % { $_| Start-ScheduledTask; sleep 2;$_| Get-ScheduledTaskInfo |selectTaskName, Last* };$Shell = New-Object -ComObject Shell.Application;$Shell.open("intunemanagementextension://syncapp");$Shell.open("intunemanagementextension://synccompliance")
# ###################################################################################################################