| Invarosoft Thursday · Webinar takeaway · ITAppsPanel |
Self-service troubleshooting scripts with ITAppsPanel
Ideas, guardrails, deployment guidance and example scripts for common end-user fixes.
| Critical disclaimer: brainstorming material only. Use entirely at your own risk. The PowerShell ideas, commands and sample files in this document are provided only as educational and brainstorming material. They are not production-ready instructions, managed services advice, security advice or legal advice, nor a warranty that any script is safe or appropriate for a particular device, customer, environment, operating system, policy or configuration. Invarosoft, the webinar presenters, authors, distributors and related parties accept no responsibility or liability for any direct, indirect, incidental, consequential, operational, commercial, security, privacy, data-loss, service-interruption, configuration, credential, licensing, compliance or support impact arising from the review, testing, modification, deployment, execution or misuse of this material, to the fullest extent permitted by applicable law. Any MSP, IT provider, administrator or end customer who chooses to use this material is solely responsible for independent technical review, security validation, legal review, change control, customer approval, testing, backups, rollback planning, permissions, logging, monitoring, documentation and ongoing maintenance. Don’t deploy these examples directly into a production environment without first reviewing and adapting them to your own standards. This disclaimer should itself be reviewed by your legal adviser before publication or commercial use. |
Why this matters: ITAppsPanel can launch approved local executables and command files. That opens the door to carefully controlled self-service troubleshooting for end users, such as repairing network settings, clearing a stuck print queue, restarting collaboration apps or collecting diagnostic information before a ticket is escalated.
The idea is simple: turn repeatable Tier 1 troubleshooting into clearly labelled buttons, while keeping the scripts centrally controlled, logged, tested and protected from changes.
C:\ITSupport\ ├── Scripts\ ├── Logs\ └── Backups\
| Script | Typical use | Main caution |
| Repair Network | DNS failures, limited connectivity, DHCP issues | May need elevation and a restart |
| Repair M365 Sign-In | Repeated sign-in prompts or a stale authentication cache | Can sign users out and close apps |
| Repair Printing | Stuck jobs, offline queue, spooler problems | Deletes pending print jobs |
| Restart Collaboration Apps | Frozen Outlook, Teams, OneDrive or WebView2 | Unsaved work may be lost |
| Collect Diagnostics | Gather useful support information before escalating | Reports may contain device and user data |
| Test first | Validate every script in a lab and with a pilot group before using it in production. |
| Protect the folder | Standard users should be able to run approved scripts, but not replace or edit them. |
| Sign scripts | Use code signing and a suitable PowerShell execution policy wherever practical. |
| Use least privilege | Only elevate the specific scripts and actions that really need administrator rights. |
| Log actions | Record timestamps, computer names, user context, actions attempted and outcomes. |
| Warn users clearly | Scripts that close apps, reset services, delete queues or require signing in again should show a confirmation prompt. |
| Plan rollback | Document what each script changes and how an engineer can reverse or recover from it. |
| Review privacy | Diagnostic reports can contain usernames, device details, IP addresses, event logs and security information. |
Before copying any code below: these examples are intentionally generic. Add your environment-specific exclusions, endpoint security controls, RMM policies, Intune policies, application versions, customer approvals and support procedures before using them.
| Repair network and DNS issues Script 1 · Repair-Network.ps1 |
Flushes DNS, renews DHCP, resets Winsock and TCP/IP, and runs connectivity checks.
Risk note: administrator rights required. A restart may be needed.
Save as: C:\ITSupport\Scripts\Repair-Network.ps1
#requires -version 5.1
<#
.SYNOPSIS
Repairs common Windows network and DNS issues.
.DESCRIPTION
Flushes the DNS cache, renews DHCP addressing, resets Winsock and TCP/IP,
and performs basic connectivity tests.
.NOTES
Requires administrator rights.
A computer restart may be required.
#>
$ErrorActionPreference = "Continue"
$currentIdentity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($currentIdentity)
$isAdmin = $principal.IsInRole(
[Security.Principal.WindowsBuiltInRole]::Administrator
)
if (-not $isAdmin) {
Write-Host "Administrator permission is required." -ForegroundColor Yellow
Start-Process powershell.exe `
-ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" `
-Verb RunAs
exit
}
$logFolder = "C:\ITSupport\Logs"
if (-not (Test-Path $logFolder)) {
New-Item -Path $logFolder -ItemType Directory -Force | Out-Null
}
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
$logFile = Join-Path $logFolder "NetworkRepair-$env:COMPUTERNAME-$timestamp.log"
Start-Transcript -Path $logFile -Force
Write-Host ""
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host " NETWORK REPAIR UTILITY" -ForegroundColor Cyan
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Current network configuration:" -ForegroundColor Yellow
Get-NetIPConfiguration | Format-List InterfaceAlias, IPv4Address, IPv4DefaultGateway, DNSServer
Write-Host "Flushing DNS cache..." -ForegroundColor Yellow
ipconfig /flushdns
Write-Host "Clearing the ARP cache..." -ForegroundColor Yellow
arp.exe -d *
Write-Host "Releasing DHCP addresses..." -ForegroundColor Yellow
ipconfig /release
Start-Sleep -Seconds 3
Write-Host "Renewing DHCP addresses..." -ForegroundColor Yellow
ipconfig /renew
Write-Host "Resetting Winsock..." -ForegroundColor Yellow
netsh winsock reset
Write-Host "Resetting the TCP/IP stack..." -ForegroundColor Yellow
netsh int ip reset
Write-Host ""
Write-Host "Testing local TCP/IP..." -ForegroundColor Yellow
Test-Connection -ComputerName "127.0.0.1" -Count 2
Write-Host ""
Write-Host "Testing internet connectivity using 1.1.1.1..." -ForegroundColor Yellow
Test-Connection -ComputerName "1.1.1.1" -Count 2
Write-Host ""
Write-Host "Testing DNS resolution..." -ForegroundColor Yellow
try {
Resolve-DnsName "www.microsoft.com" -ErrorAction Stop |
Select-Object Name, Type, IPAddress
}
catch {
Write-Warning "DNS resolution failed: $($_.Exception.Message)"
}
Write-Host ""
Write-Host "Network repair completed." -ForegroundColor Green
Write-Host "A restart is recommended because Winsock and TCP/IP were reset." -ForegroundColor Yellow
Write-Host "Log saved to: $logFile" -ForegroundColor Cyan
Stop-Transcript
Read-Host "Press Enter to close"
| Repair Microsoft 365 sign-in Script 2 · Repair-M365SignIn.ps1 |
Closes common Microsoft 365 apps, restarts selected services, clears temporary identity caches and opens the work-account settings.
Risk note: users may need to sign in again. Unsaved work may be lost.
Save as: C:\ITSupport\Scripts\Repair-M365SignIn.ps1
#requires -version 5.1
<#
.SYNOPSIS
Performs a conservative repair of Microsoft 365 sign-in components.
.DESCRIPTION
Closes Microsoft 365 applications, restarts relevant Windows services,
clears selected temporary authentication cache locations, and opens
Windows work-account settings.
.WARNING
The user may need to sign in again after this script runs.
#>
$ErrorActionPreference = "Continue"
$currentIdentity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($currentIdentity)
$isAdmin = $principal.IsInRole(
[Security.Principal.WindowsBuiltInRole]::Administrator
)
if (-not $isAdmin) {
Write-Host "Administrator permission is required." -ForegroundColor Yellow
Start-Process powershell.exe `
-ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" `
-Verb RunAs
exit
}
$logFolder = "C:\ITSupport\Logs"
if (-not (Test-Path $logFolder)) {
New-Item -Path $logFolder -ItemType Directory -Force | Out-Null
}
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
$logFile = Join-Path $logFolder "M365SignInRepair-$env:COMPUTERNAME-$timestamp.log"
Start-Transcript -Path $logFile -Force
Write-Host ""
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host " MICROSOFT 365 SIGN-IN REPAIR" -ForegroundColor Cyan
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Microsoft 365 applications will be closed." -ForegroundColor Yellow
Write-Host "Unsaved work may be lost." -ForegroundColor Red
Write-Host ""
$confirmation = Read-Host "Type YES to continue"
if ($confirmation -ne "YES") {
Write-Host "Operation cancelled." -ForegroundColor Yellow
Stop-Transcript
exit
}
$processNames = @(
"OUTLOOK",
"WINWORD",
"EXCEL",
"POWERPNT",
"ONENOTE",
"MSACCESS",
"Teams",
"ms-teams",
"OneDrive"
)
foreach ($processName in $processNames) {
$processes = Get-Process -Name $processName -ErrorAction SilentlyContinue
if ($processes) {
Write-Host "Closing $processName..." -ForegroundColor Yellow
$processes | Stop-Process -Force -ErrorAction SilentlyContinue
}
}
Start-Sleep -Seconds 3
$serviceNames = @(
"wlidsvc",
"TokenBroker",
"WebClient"
)
foreach ($serviceName in $serviceNames) {
$service = Get-Service -Name $serviceName -ErrorAction SilentlyContinue
if ($service) {
try {
Write-Host "Restarting service: $serviceName" -ForegroundColor Yellow
if ($service.Status -eq "Running") {
Restart-Service -Name $serviceName -Force -ErrorAction Stop
}
else {
Start-Service -Name $serviceName -ErrorAction Stop
}
}
catch {
Write-Warning "Could not restart $serviceName: $($_.Exception.Message)"
}
}
}
$cacheLocations = @(
"$env:LOCALAPPDATA\Microsoft\Windows\INetCache\*",
"$env:LOCALAPPDATA\Microsoft\IdentityCache\*"
)
foreach ($cacheLocation in $cacheLocations) {
Write-Host "Clearing temporary cache: $cacheLocation" -ForegroundColor Yellow
try {
Remove-Item -Path $cacheLocation `
-Recurse `
-Force `
-ErrorAction SilentlyContinue
}
catch {
Write-Warning "Some cache files could not be removed."
}
}
$oneDriveLocations = @(
"$env:LOCALAPPDATA\Microsoft\OneDrive\OneDrive.exe",
"$env:ProgramFiles\Microsoft OneDrive\OneDrive.exe",
"${env:ProgramFiles(x86)}\Microsoft OneDrive\OneDrive.exe"
)
$oneDriveExecutable = $oneDriveLocations |
Where-Object { Test-Path $_ } |
Select-Object -First 1
if ($oneDriveExecutable) {
Write-Host "Starting OneDrive..." -ForegroundColor Yellow
Start-Process $oneDriveExecutable
}
Write-Host ""
Write-Host "Opening Windows work-account settings..." -ForegroundColor Yellow
Start-Process "ms-settings:workplace"
Write-Host ""
Write-Host "Repair completed." -ForegroundColor Green
Write-Host "The user may need to sign in to Microsoft 365 again." -ForegroundColor Yellow
Write-Host "Log saved to: $logFile" -ForegroundColor Cyan
Stop-Transcript
Read-Host "Press Enter to close"
| Clear stuck print jobs Script 3 · Repair-Printing.ps1 |
Stops the Print Spooler, removes queued spool files, restarts the service and shows the printer status.
Risk note: administrator rights required. All pending print jobs are deleted.
Save as: C:\ITSupport\Scripts\Repair-Printing.ps1
#requires -version 5.1
<#
.SYNOPSIS
Clears stuck print jobs and restarts Windows printing services.
.WARNING
All pending print jobs on this computer will be deleted.
#>
$ErrorActionPreference = "Continue"
$currentIdentity = [Security.Principal.WindowsIdentity]::GetCurrent()
$principal = New-Object Security.Principal.WindowsPrincipal($currentIdentity)
$isAdmin = $principal.IsInRole(
[Security.Principal.WindowsBuiltInRole]::Administrator
)
if (-not $isAdmin) {
Write-Host "Administrator permission is required." -ForegroundColor Yellow
Start-Process powershell.exe `
-ArgumentList "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" `
-Verb RunAs
exit
}
$logFolder = "C:\ITSupport\Logs"
if (-not (Test-Path $logFolder)) {
New-Item -Path $logFolder -ItemType Directory -Force | Out-Null
}
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
$logFile = Join-Path $logFolder "PrintingRepair-$env:COMPUTERNAME-$timestamp.log"
Start-Transcript -Path $logFile -Force
Write-Host ""
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host " PRINTING REPAIR UTILITY" -ForegroundColor Cyan
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "This will remove all pending print jobs." -ForegroundColor Yellow
$confirmation = Read-Host "Type YES to continue"
if ($confirmation -ne "YES") {
Write-Host "Operation cancelled." -ForegroundColor Yellow
Stop-Transcript
exit
}
Write-Host ""
Write-Host "Current printers:" -ForegroundColor Yellow
try {
Get-Printer |
Select-Object Name, DriverName, PortName, PrinterStatus, Default |
Format-Table -AutoSize
}
catch {
Write-Warning "Could not retrieve printer information."
}
Write-Host ""
Write-Host "Current print jobs:" -ForegroundColor Yellow
try {
Get-Printer | ForEach-Object {
$printerName = $_.Name
Get-PrintJob -PrinterName $printerName -ErrorAction SilentlyContinue |
Select-Object @{Name = "Printer"; Expression = { $printerName } },
ID,
DocumentName,
JobStatus,
SubmittedTime
} | Format-Table -AutoSize
}
catch {
Write-Warning "Could not retrieve all print jobs."
}
Write-Host "Stopping Print Spooler..." -ForegroundColor Yellow
Stop-Service -Name Spooler -Force -ErrorAction SilentlyContinue
Start-Sleep -Seconds 2
$spoolFolder = Join-Path $env:SystemRoot "System32\spool\PRINTERS"
if (Test-Path $spoolFolder) {
Write-Host "Clearing print queue files..." -ForegroundColor Yellow
Get-ChildItem -Path $spoolFolder -Force -ErrorAction SilentlyContinue |
Remove-Item -Force -Recurse -ErrorAction SilentlyContinue
}
Write-Host "Starting Print Spooler..." -ForegroundColor Yellow
Start-Service -Name Spooler -ErrorAction SilentlyContinue
Start-Sleep -Seconds 3
$spooler = Get-Service -Name Spooler
if ($spooler.Status -eq "Running") {
Write-Host "Print Spooler is running." -ForegroundColor Green
}
else {
Write-Warning "Print Spooler did not start successfully."
}
Write-Host ""
Write-Host "Printers after repair:" -ForegroundColor Yellow
try {
Get-Printer |
Select-Object Name, PrinterStatus, PortName |
Format-Table -AutoSize
}
catch {
Write-Warning "Could not retrieve printer information."
}
Write-Host ""
Write-Host "Printing repair completed." -ForegroundColor Green
Write-Host "Log saved to: $logFile" -ForegroundColor Cyan
Write-Host "Opening Windows printer settings..." -ForegroundColor Yellow
Start-Process "ms-settings:printers"
Stop-Transcript
Read-Host "Press Enter to close"
| Restart Outlook, Teams and OneDrive Script 4 · Restart-CollaborationApps.ps1 |
Closes the collaboration apps, clears selected Teams cache locations, checks Microsoft 365 connectivity and relaunches the apps.
Risk note: unsaved drafts or work may be lost.
Save as: C:\ITSupport\Scripts\Restart-CollaborationApps.ps1
#requires -version 5.1
<#
.SYNOPSIS
Restarts Outlook, Microsoft Teams, OneDrive, and WebView2.
.DESCRIPTION
Closes the applications, clears selected temporary Teams cache folders,
performs Microsoft 365 connectivity tests, and restarts installed apps.
.WARNING
Unsaved drafts or documents may be lost.
#>
$ErrorActionPreference = "Continue"
$logFolder = "C:\ITSupport\Logs"
if (-not (Test-Path $logFolder)) {
New-Item -Path $logFolder -ItemType Directory -Force | Out-Null
}
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
$logFile = Join-Path $logFolder "CollaborationApps-$env:COMPUTERNAME-$timestamp.log"
Start-Transcript -Path $logFile -Force
Write-Host ""
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host " OUTLOOK, TEAMS AND ONEDRIVE RESTART" -ForegroundColor Cyan
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Unsaved work in these applications may be lost." -ForegroundColor Red
$confirmation = Read-Host "Type YES to continue"
if ($confirmation -ne "YES") {
Write-Host "Operation cancelled." -ForegroundColor Yellow
Stop-Transcript
exit
}
$outlookPaths = @(
"$env:ProgramFiles\Microsoft Office\root\Office16\OUTLOOK.EXE",
"${env:ProgramFiles(x86)}\Microsoft Office\root\Office16\OUTLOOK.EXE"
)
$oneDrivePaths = @(
"$env:LOCALAPPDATA\Microsoft\OneDrive\OneDrive.exe",
"$env:ProgramFiles\Microsoft OneDrive\OneDrive.exe",
"${env:ProgramFiles(x86)}\Microsoft OneDrive\OneDrive.exe"
)
$outlookExecutable = $outlookPaths |
Where-Object { Test-Path $_ } |
Select-Object -First 1
$oneDriveExecutable = $oneDrivePaths |
Where-Object { Test-Path $_ } |
Select-Object -First 1
$processNames = @(
"OUTLOOK",
"Teams",
"ms-teams",
"OneDrive",
"msedgewebview2"
)
foreach ($processName in $processNames) {
$processes = Get-Process -Name $processName -ErrorAction SilentlyContinue
if ($processes) {
Write-Host "Closing $processName..." -ForegroundColor Yellow
$processes | Stop-Process -Force -ErrorAction SilentlyContinue
}
}
Start-Sleep -Seconds 4
$classicTeamsCacheLocations = @(
"$env:APPDATA\Microsoft\Teams\Cache\*",
"$env:APPDATA\Microsoft\Teams\Code Cache\*",
"$env:APPDATA\Microsoft\Teams\GPUCache\*",
"$env:APPDATA\Microsoft\Teams\blob_storage\*",
"$env:APPDATA\Microsoft\Teams\databases\*",
"$env:APPDATA\Microsoft\Teams\logs\*",
"$env:APPDATA\Microsoft\Teams\tmp\*"
)
foreach ($cacheLocation in $classicTeamsCacheLocations) {
if (Test-Path $cacheLocation) {
Write-Host "Clearing Teams temporary cache..." -ForegroundColor Yellow
Remove-Item -Path $cacheLocation `
-Recurse `
-Force `
-ErrorAction SilentlyContinue
}
}
Write-Host ""
Write-Host "Testing Microsoft 365 connectivity..." -ForegroundColor Yellow
$testHosts = @(
"login.microsoftonline.com",
"outlook.office.com",
"teams.microsoft.com",
"onedrive.live.com"
)
foreach ($testHost in $testHosts) {
try {
$testResult = Test-NetConnection `
-ComputerName $testHost `
-Port 443 `
-WarningAction SilentlyContinue
if ($testResult.TcpTestSucceeded) {
Write-Host "$testHost : Port 443 reachable" -ForegroundColor Green
}
else {
Write-Warning "$testHost : Port 443 not reachable"
}
}
catch {
Write-Warning "Could not test $testHost"
}
}
Write-Host ""
Write-Host "Restarting applications..." -ForegroundColor Yellow
if ($oneDriveExecutable) {
Start-Process $oneDriveExecutable
Write-Host "OneDrive started." -ForegroundColor Green
}
try {
Start-Process "msteams:"
Write-Host "Teams start request sent." -ForegroundColor Green
}
catch {
Write-Warning "Teams could not be started automatically."
}
if ($outlookExecutable) {
Start-Process $outlookExecutable
Write-Host "Outlook started." -ForegroundColor Green
}
else {
try {
Start-Process "outlook.exe"
Write-Host "Outlook start request sent." -ForegroundColor Green
}
catch {
Write-Warning "Outlook could not be located."
}
}
Write-Host ""
Write-Host "Application restart completed." -ForegroundColor Green
Write-Host "Log saved to: $logFile" -ForegroundColor Cyan
Stop-Transcript
Read-Host "Press Enter to close"
| Collect support diagnostics Script 5 · Collect-SupportDiagnostics.ps1 |
Creates a report with Windows, hardware, disk, network, printer, BitLocker, pending-restart, services, process and event-log information.
Risk note: designed to be read-only, but the output may contain device and user information.
Save as: C:\ITSupport\Scripts\Collect-SupportDiagnostics.ps1
#requires -version 5.1
<#
.SYNOPSIS
Collects common Windows troubleshooting information.
.DESCRIPTION
Creates a diagnostic report that can be sent to the IT support team.
The script does not intentionally change system settings.
#>
$ErrorActionPreference = "Continue"
$logFolder = "C:\ITSupport\Logs"
if (-not (Test-Path $logFolder)) {
New-Item -Path $logFolder -ItemType Directory -Force | Out-Null
}
$timestamp = Get-Date -Format "yyyyMMdd-HHmmss"
$reportFile = Join-Path $logFolder "SupportDiagnostics-$env:COMPUTERNAME-$timestamp.txt"
function Add-Section {
param (
[Parameter(Mandatory)]
[string]$Title
)
Add-Content -Path $reportFile -Value ""
Add-Content -Path $reportFile -Value ("=" * 78)
Add-Content -Path $reportFile -Value $Title
Add-Content -Path $reportFile -Value ("=" * 78)
}
function Add-CommandOutput {
param (
[Parameter(Mandatory)]
[scriptblock]$Command
)
try {
$output = & $Command | Out-String -Width 250
Add-Content -Path $reportFile -Value $output
}
catch {
Add-Content -Path $reportFile -Value "ERROR: $($_.Exception.Message)"
}
}
Write-Host ""
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host " SUPPORT DIAGNOSTICS COLLECTOR" -ForegroundColor Cyan
Write-Host "==========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "Collecting diagnostic information..." -ForegroundColor Yellow
Set-Content -Path $reportFile -Value "IT SUPPORT DIAGNOSTIC REPORT"
Add-Content -Path $reportFile -Value "Generated: $(Get-Date)"
Add-Content -Path $reportFile -Value "Computer: $env:COMPUTERNAME"
Add-Content -Path $reportFile -Value "User: $env:USERDOMAIN\$env:USERNAME"
Add-Section "OPERATING SYSTEM"
Add-CommandOutput {
Get-CimInstance Win32_OperatingSystem |
Select-Object Caption,
Version,
BuildNumber,
OSArchitecture,
LastBootUpTime,
InstallDate
}
Add-Section "COMPUTER HARDWARE"
Add-CommandOutput {
Get-CimInstance Win32_ComputerSystem |
Select-Object Manufacturer,
Model,
TotalPhysicalMemory,
Domain,
PartOfDomain,
UserName
}
Add-CommandOutput {
Get-CimInstance Win32_BIOS |
Select-Object Manufacturer,
SMBIOSBIOSVersion,
SerialNumber,
ReleaseDate
}
Add-Section "UPTIME"
Add-CommandOutput {
$os = Get-CimInstance Win32_OperatingSystem
$uptime = (Get-Date) - $os.LastBootUpTime
[PSCustomObject]@{
LastBoot = $os.LastBootUpTime
UptimeDays = [math]::Floor($uptime.TotalDays)
UptimeHours = $uptime.Hours
UptimeMinutes = $uptime.Minutes
}
}
Add-Section "PROCESSOR AND MEMORY"
Add-CommandOutput {
Get-CimInstance Win32_Processor |
Select-Object Name,
NumberOfCores,
NumberOfLogicalProcessors,
MaxClockSpeed,
LoadPercentage
}
Add-CommandOutput {
$os = Get-CimInstance Win32_OperatingSystem
[PSCustomObject]@{
TotalMemoryGB = [math]::Round($os.TotalVisibleMemorySize / 1MB, 2)
FreeMemoryGB = [math]::Round($os.FreePhysicalMemory / 1MB, 2)
UsedMemoryGB = [math]::Round(
($os.TotalVisibleMemorySize - $os.FreePhysicalMemory) / 1MB,
2
)
}
}
Add-Section "DISK SPACE"
Add-CommandOutput {
Get-CimInstance Win32_LogicalDisk -Filter "DriveType=3" |
Select-Object DeviceID,
VolumeName,
@{Name = "SizeGB"; Expression = {[math]::Round($_.Size / 1GB, 2)}},
@{Name = "FreeGB"; Expression = {[math]::Round($_.FreeSpace / 1GB, 2)}},
@{Name = "FreePercent"; Expression = {
if ($_.Size -gt 0) {
[math]::Round(($_.FreeSpace / $_.Size) * 100, 2)
}
}}
}
Add-Section "NETWORK CONFIGURATION"
Add-CommandOutput {
Get-NetIPConfiguration |
Select-Object InterfaceAlias,
InterfaceDescription,
IPv4Address,
IPv4DefaultGateway,
DNSServer
}
Add-CommandOutput {
Get-NetAdapter |
Select-Object Name,
InterfaceDescription,
Status,
LinkSpeed,
MacAddress
}
Add-Section "NETWORK CONNECTIVITY TESTS"
Add-CommandOutput {
Test-NetConnection "1.1.1.1" -Port 443
}
Add-CommandOutput {
Test-NetConnection "login.microsoftonline.com" -Port 443
}
Add-CommandOutput {
Resolve-DnsName "www.microsoft.com"
}
Add-Section "INSTALLED PRINTERS"
Add-CommandOutput {
Get-Printer |
Select-Object Name,
DriverName,
PortName,
PrinterStatus,
Default
}
Add-Section "BITLOCKER STATUS"
Add-CommandOutput {
if (Get-Command Get-BitLockerVolume -ErrorAction SilentlyContinue) {
Get-BitLockerVolume |
Select-Object MountPoint,
VolumeStatus,
ProtectionStatus,
EncryptionPercentage,
EncryptionMethod
}
else {
"BitLocker PowerShell commands are not available."
}
}
Add-Section "PENDING RESTART CHECK"
Add-CommandOutput {
$restartReasons = New-Object System.Collections.Generic.List[string]
if (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending") {
$restartReasons.Add("Component Based Servicing")
}
if (Test-Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update\RebootRequired") {
$restartReasons.Add("Windows Update")
}
$sessionManagerPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Session Manager"
$pendingFileRename = Get-ItemProperty `
-Path $sessionManagerPath `
-Name PendingFileRenameOperations `
-ErrorAction SilentlyContinue
if ($pendingFileRename) {
$restartReasons.Add("Pending file rename operations")
}
if ($restartReasons.Count -gt 0) {
[PSCustomObject]@{
RestartPending = $true
Reasons = $restartReasons -join ", "
}
}
else {
[PSCustomObject]@{
RestartPending = $false
Reasons = "None detected"
}
}
}
Add-Section "IMPORTANT SERVICES"
Add-CommandOutput {
$serviceNames = @(
"Spooler",
"wuauserv",
"BITS",
"Winmgmt",
"EventLog",
"Dnscache"
)
Get-Service -Name $serviceNames -ErrorAction SilentlyContinue |
Select-Object Name,
DisplayName,
Status,
StartType
}
Add-Section "TOP PROCESSES BY MEMORY"
Add-CommandOutput {
Get-Process |
Sort-Object WorkingSet64 -Descending |
Select-Object -First 15 `
ProcessName,
Id,
CPU,
@{Name = "MemoryMB"; Expression = {
[math]::Round($_.WorkingSet64 / 1MB, 2)
}}
}
Add-Section "RECENT SYSTEM ERRORS"
Add-CommandOutput {
Get-WinEvent `
-FilterHashtable @{
LogName = "System"
Level = 1, 2
StartTime = (Get-Date).AddDays(-2)
} `
-MaxEvents 30 `
-ErrorAction SilentlyContinue |
Select-Object TimeCreated,
ProviderName,
Id,
LevelDisplayName,
Message
}
Add-Section "RECENT APPLICATION ERRORS"
Add-CommandOutput {
Get-WinEvent `
-FilterHashtable @{
LogName = "Application"
Level = 1, 2
StartTime = (Get-Date).AddDays(-2)
} `
-MaxEvents 30 `
-ErrorAction SilentlyContinue |
Select-Object TimeCreated,
ProviderName,
Id,
LevelDisplayName,
Message
}
Write-Host ""
Write-Host "Diagnostic report completed." -ForegroundColor Green
Write-Host "Report saved to:" -ForegroundColor Cyan
Write-Host $reportFile -ForegroundColor White
Start-Process notepad.exe -ArgumentList "`"$reportFile`""
Read-Host "Press Enter to close"Launch a script with Windows PowerShell:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\ITSupport\Scripts\Repair-Network.ps1"
Launch the diagnostics collector:
powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\ITSupport\Scripts\Collect-SupportDiagnostics.ps1"
Force the 64-bit Windows PowerShell on 64-bit Windows:
%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -File "C:\ITSupport\Scripts\Collect-SupportDiagnostics.ps1"
- Choose a repetitive, low-risk troubleshooting scenario.
- Write the script and document every action it performs.
- Add logging, error handling and a user confirmation step.
- Test it as a standard user and as an administrator.
- Review it with your security, compliance and service-delivery owners.
- Pilot it with internal staff or a small group of customers.
- Publish the approved script through ITAppsPanel.
- Monitor outcomes, failures and the reduction in support tickets.
- Version, sign and regularly review the script.
| Final reminder This document is a workshop handout, not a production runbook. The examples may be incomplete, unsuitable or harmful in a particular environment. Independent review, testing, authorization and adaptation are mandatory. Use is entirely at the implementer’s own risk. |
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article