Disclaimer
The use of commands is at your own risk. Never use commands unless you fully understand their functionality.
CMD Commands do work in Powershell in most cases (but not vice-versa) to add several commands in a single execution, in PS use ‘;’ in CMD use ‘&’
General Windows Info
Windows Version
Get-CimInstance Win32_OperatingSystem | Select-Object Caption, Versionsysteminfo | findstr /B /C:"OS Name" /B /C:"OS Version"last bootup-Time
Get-CimInstance -ClassName Win32_OperatingSystem | Select-Object LastBootUpTimesysteminfo | find "System Boot Time"Get Last Shutdown/Reboot Events
fetches shutdown/reboot events from the System Event Log (Windows PowerShell 5.1 only)
Get-EventLog -LogName system -Source user32 | Select TimeGenerated, Message -Unique | ft -WrapPowerShell 7 / Windows PowerShell:
Get-WinEvent -FilterHashtable @{LogName='System'; ProviderName='User32'; Id=1074} | Select-Object TimeCreated, Message | Format-Table -WrapPending Reboot
Install Module
Install-Module -Name PendingReboot
Import-Module PendingRebootRun CMDLet:
Test-PendingReboot -DetailedDisplay Device Domain Join Status
dsregcmd /statusGet Device-Certificate Expiration-Date
only works if Certificate Name contains the devices hostname
Get-ChildItem Cert:\LocalMachine\My |
Where-Object { $_.Subject -match $(hostname) } |
Select-Object Subject, Thumbprint, NotAfterSet/Change System Environment Variable
(applies to newly started programs, no reboot needed)
Careful: entering Path overwrites the whole Path variable
$vName = Read-Host "Name"
$vValue = Read-Host "Value"
[Environment]::SetEnvironmentVariable($vName, $vValue, 'Machine')Battery Report
powercfg /batteryreportget hotfix Info
Get-HotFix | Sort-Object -Property InstalledOn -Descending | Select-Object -First 20 -Property Description, HotFixID, InstalledOnwmic qfe list brief /format:table | findstr /i /v "Caption"wmic is deprecated and no longer installed by default on current Windows 11 builds (see Capabilities: WMIC~~~~).
Advanced query using Microsoft.Update.Session Searcher:
$Session = New-Object -ComObject "Microsoft.Update.Session"
$Searcher = $Session.CreateUpdateSearcher()
$historyCount = $Searcher.GetTotalHistoryCount()
if ($historyCount -le 0) {
Write-Warning "No Windows Update history available."
return
}
$Searcher.QueryHistory(0, $historyCount) |
Select-Object Date, Title,
@{Name="KB"; Expression={
if ($_.Title -match "KB\d+") { $matches[0] } else { "" }
}},
@{Name="Category"; Expression={
$t = $_.Title
switch -Regex ($t) {
"Kumulatives Update für Windows|Cumulative Update for Windows|Windows-Tool zum Entfernen bösartiger Software|Windows Malicious Software" { "OS patch" }
"\.NET|NET Framework" { ".NET" }
"Firmware|UEFI|BIOS" { "Firmware" }
"Treiber|Driver|Intel|NVIDIA|AMD|Realtek" { "Driver" }
"^9[A-Z0-9]{11}-" { "Store app / MSIX" }
"VCLibs|DesktopAppInstaller|NET.Native" { "MSIX framework" }
default { "Other" }
}
}},
@{Name="Operation"; Expression={
switch ($_.Operation) {
1 {"Installation"}
2 {"Uninstallation"}
3 {"Other"}
}
}},
@{Name="Result"; Expression={
$rc= $_.ResultCode
$hr = $_.HResult
$text = switch ($rc) {
0 { "Not started ($rc)" }
1 { "In progress ($rc)" }
2 { "Succeeded ($rc)" }
3 { "Succeeded with errors ($rc)" }
4 { "Failed ($rc)" }
5 { "Aborted ($rc)" }
default { "Unknown ($rc)" }
}
if ($rc -eq 4 -and $hr -ne 0) {
"$text [$( '0x{0:X8}' -f ($hr -band 0xFFFFFFFF) )]"
} else {
$text
}
}},
Description
Shutdown
shutdown PC after the time given with /t xxx (in seconds)
for reboot add /r
the /f Flag enforces the shutdown… logged in users get signed out!
on execution, active users get a notification that the PC will shutdown in t time, without further notice
shutdown /f /t 0CPU Info
CPU – Overall Usage
returns a single value of the total average usage
Get-CimInstance win32_processor | Measure-Object -Property LoadPercentage -AverageCPU – Overall Usage (continuous)
Returns a single value of the total average usage
While($true){
Get-CimInstance win32_processor | Measure-Object -Property LoadPercentage -Average | Select-Object Average
Start-Sleep -Seconds 1
} CPU – High usage processes
Get processes using the most CPU, in % of the whole CPU like in Task ManagerGet-Process only reports the CPU time in seconds since the process started, so the script reads it twice, 2 seconds apart, and converts the difference: seconds / 2 / logical cores * 100-gt 1 = more than 1% CPU. Run as Admin to also see processes of other users and services.
$seconds = 2
$cores = [Environment]::ProcessorCount
$before = @{}
Get-Process | Where-Object { $null -ne $_.CPU } | ForEach-Object { $before[$_.Id] = $_.CPU }
Start-Sleep -Seconds $seconds
Get-Process | Where-Object { $before.ContainsKey($_.Id) -and $null -ne $_.CPU } |
Select-Object Id, ProcessName, @{Name = 'CPU %'; Expression = { [math]::Round(($_.CPU - $before[$_.Id]) / $seconds / $cores * 100, 1) }} |
Where-Object { $_.'CPU %' -gt 1 } | Sort-Object 'CPU %' -DescendingWindows System
Bypass Execution Policy
Allow temporary Script-Execution
Set-ExecutionPolicy -Scope Process BypassWindows Troubleshooter (old, GUI)
Win11: Microsoft moves Troubleshooter to their “Get Help” app.
Currently, most Troubleshooters known until Windows 10 are still available in Win11 23H2 using msdt.exe
For a list of available packages, see Available Troubleshooting packs.
Example: Run Network Adapter Diagnostics:
msdt.exe /id NetworkDiagnosticsNetworkAdapterWindows Troubleshooter (Powershell cmdlet, unattended)
Get-TroubleshootingPack -Path C:\Windows\diagnostics\system\WindowsUpdate | Invoke-TroubleshootingPack -UnattendedOther Diagnostic-Paths:
| Diagnostics Pack | Directory |
|---|---|
| Apps | C:\Windows\Diagnostics\System\Apps |
| Audio | C:\Windows\Diagnostics\System\Audio |
| BITS (Background Intelligent Transfer Service) | C:\Windows\Diagnostics\System\BITS |
| Bluetooth | C:\Windows\Diagnostics\System\Bluetooth |
| Device (Hardware and Devices Troubleshooter) | C:\Windows\Diagnostics\System\Device |
| DeviceCenter (specific Devices, requires Device Container ID) | C:\Windows\Diagnostics\System\DeviceCenter |
| IEBrowseWeb | C:\Windows\Diagnostics\System\IEBrowseWeb |
| IESecurity | C:\Windows\Diagnostics\System\IESecurity |
| Keyboard | C:\Windows\Diagnostics\System\Keyboard |
| Networking | C:\Windows\Diagnostics\System\Networking |
| Program Compatibility Wizard | C:\Windows\Diagnostics\System\PCW |
| Power | C:\Windows\Diagnostics\System\Power |
| Printer | C:\Windows\Diagnostics\System\Printer |
| Search | C:\Windows\Diagnostics\System\Search |
| Speech | C:\Windows\Diagnostics\System\Speech |
| Video | C:\Windows\Diagnostics\System\Video |
| WindowsMediaPlayerConfiguration | C:\Windows\Diagnostics\System\WindowsMediaPlayerConfiguration |
| WindowsMediaPlayerMediaLibrary | C:\Windows\Diagnostics\System\WindowsMediaPlayerMediaLibrary |
| WindowsMediaPlayerPlayDVD | C:\Windows\Diagnostics\System\WindowsMediaPlayerPlayDVD |
| WindowsUpdate | C:\Windows\Diagnostics\System\WindowsUpdate |
General System Repair
System-Files & Component Store Repair
(PowerShell command notifies the user after completion)
$(
Start-Process DISM.exe -Wait -NoNewWindow -ArgumentList "/Online /Cleanup-image /Scanhealth"
Start-Process DISM.exe -Wait -NoNewWindow -ArgumentList "/Online /Cleanup-image /RestoreHealth"
Start-Process SFC.exe -Wait -NoNewWindow -ArgumentList "/scannow"
# Notify the user
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
$msg="Please Restart your Device using the 'Restart' option."
$notification = New-Object System.Windows.Forms.NotifyIcon
$notification.Icon = [System.Drawing.SystemIcons]::Information
$notification.BalloonTipTitle = "Windows System Repair"
$notification.BalloonTipText = $msg
$notification.Visible = $true
$notification.ShowBalloonTip(30000)
# Activate the PS Window to notify the user
Add-Type -AssemblyName Microsoft.VisualBasic
[Microsoft.VisualBasic.Interaction]::AppActivate($PID)
Write-Host "`r`nSystem-Repair completed" -ForegroundColor Green
Write-Host $msg
Pause ; exit
)DISM.exe /Online /Cleanup-image /Scanhealth
DISM.exe /Online /Cleanup-image /RestoreHealth
sfc /scannowComponent Store Cleanup
if /RestoreHealth results in an error that the source files can not be found, this may sometimes resolve the issue
DISM /Online /Cleanup-Image /AnalyzeComponentStoreif /AnalyzeComponentStore results in the information that a Component Store Cleanup is advised, proceed with the following
DISM /Online /Cleanup-Image /StartComponentCleanupMemory Repair
Each (Efficiency)CPU core can scan 4 GB in parallel in about 20 minutes (limited by RAM/DDR speed limits)
e.g. 4-core CPU scans 16 GB in 20 min, 2-core CPU scans 16 GB in 40 min, 8-core CPU scans 16 GB in 20 min as well
MDSCHEDDisk Check and repair
- /r: This switch tells CHKDSK to locate bad sectors in the disk and attempt to recover any readable information from them. It also implies the functionality of /f, so you don’t need to specify /f separately.
- /f: This switch tells CHKDSK to fix any errors it finds on the disk.
chkdsk /r /fSpecific System Repair
Reset Explorer Views
force resets all Explorer view Settings
Delete the following keys and restart Explorer
HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\Bags
HKEY_CURRENT_USER\Software\Microsoft\Windows\Shell\BagMRUAlways Details view for every folder without a view set by the user: turns off the automatic folder type detection (Pictures/Music/Videos layout chosen by the folder content) and makes Details the default view of every folder type. Runs as the user (no Admin needed) and restarts Explorer.
Folders with a saved view keep it: reset them first with the keys above.
# no folder type detection by content: every folder uses "General items"
$shellKey = 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell'
if (-not (Test-Path $shellKey)) { New-Item -Path $shellKey -Force | Out-Null }
Set-ItemProperty -Path $shellKey -Name FolderType -Value 'NotSpecified'
# Details as default view of every folder type (per-user copy of the templates)
$types = 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes'
if (-not (Test-Path $types)) {
Copy-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes' -Destination (Split-Path $types) -Recurse
}
Get-ChildItem -Path $types -Recurse | Where-Object { $null -ne $_.GetValue('LogicalViewMode') } | ForEach-Object {
Set-ItemProperty -Path $_.PSPath -Name LogicalViewMode -Value 1
Set-ItemProperty -Path $_.PSPath -Name IconSize -Value 16
}
Stop-Process -Name explorer -Forceundo:
Remove-Item -Path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\FolderTypes' -Recurse
Remove-ItemProperty -Path 'HKCU:\Software\Classes\Local Settings\Software\Microsoft\Windows\Shell\Bags\AllFolders\Shell' -Name FolderType
Stop-Process -Name explorer -ForceRepair WMI repository
winmgmt /verifyrepository
winmgmt /salvagerepository
stop-service -force winmgmt
start-service winmgmtRepair All AppxPackages
Repair all Packages and system modules
remove -AllUsers to only repair the modules for the current user (Users may have separate modules from -AllUsers)
Get-AppxPackage -AllUsers | ForEach-Object {
Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"
}Further information can be found here: MS Store & Winget: App-Management in Windows
Repair Specific AppxPackages
Repair a specific Module (such as DesktopAppInstaller/Winget)
remove -AllUsers to only repair the modules for the current user (Users may have separate modules from -AllUsers). Change -Name if needed for a different module.
Get-AppxPackage -Name Microsoft.DesktopAppInstaller -AllUsers | ForEach-Object {
Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"
}Other AppxPackages:
Further information can be found here: Windows Explorer: A Powerhouse for it all
Microsoft.Windows.ShellExperienceHost→ Handles the Taskbar, Start Menu, and other shell components.Microsoft.Windows.Taskbar(on newer builds) → Manages specific Taskbar-related functionality.Microsoft.Windows.ActionCenter→ Controls the notification area (Action Center), a part of the Taskbar.Microsoft.Windows.StartMenuExperienceHost→ Responsible for rendering the Start Menu UI.Microsoft.Windows.Photos→ Windows Photos ApplicationMicrosoft.BingSearch-> responsible for the Web-Search integration in Windows Search (such as Taskbar Search or Startmenu)
General Windows Update Troubleshoot
Windows-Update Troubleshooter (old)
msdt.exe /id WindowsUpdateDiagnosticWindows-Update Troubleshooter (cmdlet)
Get-TroubleshootingPack -Path C:\Windows\diagnostics\system\WindowsUpdate | Invoke-TroubleshootingPack -Unattended
Get-TroubleshootingPack -Path C:\Windows\diagnostics\system\BITS | Invoke-TroubleshootingPack -UnattendedReset WUA & BITS Services
$currentDateTime = (Get-Date).ToString("yyyy-MM-dd_HH-mm")
$softwareDistributionPath = "$Env:systemroot\SoftwareDistribution"
$downloadPath = "$softwareDistributionPath\Download"
$catroot2Path = "$Env:systemroot\system32\catroot2"
$catroot2BackupPath = "$catroot2Path.bak"
$Services = 'msiserver', 'trustedinstaller', 'ccmexec', 'wuauserv', 'bits', 'appidsvc', 'cryptsvc', 'smstsmgr'
Get-Process 'msiexec', 'trustedinstaller', 'ccmexec' -ErrorAction SilentlyContinue | Stop-Process -Force
Get-Service $Services -ErrorAction SilentlyContinue | Stop-Service -Force
# Force-delete the Download cache only — DataStore (update history) and ReportingEvents.log are untouched
if (Test-Path -Path $downloadPath) {
Write-Verbose "Deleting $downloadPath..."
Remove-Item -LiteralPath "\\?\$downloadPath" -Recurse -Force -ErrorAction SilentlyContinue
}
if (Test-Path -Path $catroot2BackupPath) {
Write-Verbose "Backup directory exists. Deleting $catroot2BackupPath..."
Remove-Item -LiteralPath "\\?\$catroot2BackupPath" -Recurse -Force -ErrorAction SilentlyContinue
}
if (Test-Path -Path $catroot2Path) {
Rename-Item -LiteralPath "\\?\$catroot2Path" -NewName catroot2.bak -ErrorAction SilentlyContinue
}
Get-Service $Services -ErrorAction SilentlyContinue | Start-Service
$successMessage = "Windows Update Cleanup completed successfully.`r`nDownload cache was deleted and catroot2 was renamed; update history was preserved."
Write-Host "`r`n`r`n[$currentDateTime] - INFO:`r`n$successMessage"net stop bits
net stop wuauserv
net stop cryptsvc
net stop appidsvc
net stop msiserver
net stop trustedinstaller
net stop ccmexec
net stop smstsmgr
rmdir %systemroot%\SoftwareDistribution\Download /S /Q
if exist %systemroot%\system32\catroot2.bak rmdir %systemroot%\system32\catroot2.bak /S /Q
ren %systemroot%\system32\catroot2 catroot2.bak
net start cryptsvc
net start wuauserv
net start bits
net start appidsvc
net start msiserver
net start trustedinstaller
net start ccmexec
net start smstsmgr Windows Update Install (PowerShell)
install module
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force
Install-Module -Name PSWindowsUpdate -Force
Get-Package -Name PSWindowsUpdate
Import-Module PSWindowsUpdateinstall Update
(switch -KBArticleID to -updateID to use Windows update Catalog UpdateID instead of KB-number)
Get-WindowsUpdate -Install -KBArticleID KB5017308Network-Drive Mapping Fix
Windows tries to map the network drives immediately when loading the Profile, even if no network is available… This may cause the Drives not to be available in the Explorer.
As prevention, run gpedit and enable the policy: “Always wait for the network at computer startup and logon” located under Computer Configuration -> Policies -> Administrative Templates -> System -> Logon
Restart the Services:
Stop-Service @('FDResPub','fdPHost')
Start-Service @('fdPHost','FDResPub')Restart Printer Spooler
restart-service spoolernet stop spooler
net start spoolerEnable Win32 Long Paths
Enable the use of long File-Paths (usually max 260, long-path max: 32.767)
(requires reboot afterwards)
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -ForceThe policy can overrule the registry value, so set it as well:
- Open
gpedit.mscas Administrator - Go to Computer Configuration > Administrative Templates > System > Filesystem
- Double-click Enable Win32 long paths
- Select Enabled and click OK
- Apply it:
gpupdate /target:computer /force - Restart the computer
A domain GPO overrules the local policy. Check which policy sets the value (run as Admin):
$value = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name LongPathsEnabled -ErrorAction SilentlyContinue).LongPathsEnabled
$policy = Get-CimInstance -Namespace root\rsop\computer -ClassName RSOP_RegistryPolicySetting -Filter "valueName='LongPathsEnabled'" | Sort-Object precedence | Select-Object -First 1
[pscustomobject]@{
LongPathsEnabled = $value
SetByPolicy = if ($policy) { (Get-CimInstance -Namespace root\rsop\computer -ClassName RSOP_GPO | Where-Object id -eq $policy.GPOID).name } else { 'no' }
PolicyValue = if ($policy) { [BitConverter]::ToInt32($policy.value, 0) } else { $null }
}SetByPolicy = name of the GPO: change the setting there. Intune policies don’t show up in this check.
Only programs that declare long path support use it (e.g. PowerShell 7, many .NET apps); File Explorer and many older programs may still stop at 260 characters.
Reset Logon Cache
e.g. if running sfc /scannow as admin states that you need to be Admin
- as Administrator, open Local Security Policy (secpol.msc)
- navigate to: Local Policies > Security Options > search for Interactive logon: Number of previous logons to cache (in case domain controller is not available)
- change value to 0
- sign out & back in
- Change back to 10
- Sign out & back in
Check User Sessions
get logged in users on machine
query userlog off specific session (replace <ID> from command-result above)
logoff <ID>Delete Windows-Hello Container
Deletes for the signed in User the Windows Hello credentials (PIN, FaceID, Fingerprint)
certutil.exe -DeleteHelloContainerDelete the Ngc folder: if deleting the container is not enough. Administrators have no access to the folder until they take ownership.
Removes the Windows Hello sign-in (PIN, FaceID, Fingerprint) of all users on this device. Make sure the account passwords are known.
Manual:
- In Explorer, open
C:\Windows\ServiceProfiles\LocalService\AppData\Local\Microsoftand confirm the permission prompts with Continue - Right-click Ngc > Properties > Security > Advanced
- Next to Owner click Change, enter
Administrators(German Windows:Administratoren) and click OK - Tick Replace owner on subcontainers and objects and click OK, then close the Properties window
- Open Properties > Security > Advanced again, click Add > Select a principal, enter the same group, tick Full control and click OK
- Tick Replace all child object permission entries with inheritable permission entries from this object and click OK
- Delete the Ngc folder
- Restart the computer, sign in with the password and set up Windows Hello again under Settings > Accounts > Sign-in options
PowerShell (run as Admin), then restart the computer and set up Windows Hello again:
$ngc = "$env:windir\ServiceProfiles\LocalService\AppData\Local\Microsoft\Ngc"
function Grant-Admins($path) {
takeown /f $path /a | Out-Null
icacls $path /grant '*S-1-5-32-544:F' | Out-Null # '*S-1-5-32-544:F' is the Administrators-Group
if (Test-Path -LiteralPath $path -PathType Container) {
Get-ChildItem -LiteralPath $path -Force | ForEach-Object { Grant-Admins $_.FullName }
}
}
Grant-Admins $ngc
Remove-Item -LiteralPath $ngc -Recurse -ForceWindows creates the folder again when the Windows Hello services start.
long Shutdown Fix
- Win Settings > Updates > Troubleshoot > additional troubleshooters > Power
- Turn off fast boot via Control Panel -> Power Options -> Choose what the Power buttons do
- turn off clearing PageFile on shutdown by changing ClearPageFileAtShutdown to 0 :
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management- change WaitToKillServiceTimeout to 2000 (or higher)
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ControlSoftware Uninstallation
Uninstallation troubleshooter:
To troubleshoot failing installs and un-installs, Microsoft provides a specific Troubleshooter:
Simply download via this direct-Link, or via support.microsoft.com.
Get all installed Software (via Registry)
fast, lists everything shown in Apps > Installed apps (machine-wide 64/32-bit and current user)
Get-ItemProperty 'HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*', 'HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\*', 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Uninstall\*' |
Where-Object DisplayName | Select-Object DisplayName, DisplayVersion, Publisher, UninstallString | Sort-Object DisplayNameGet all installed Software (via WMI)
slow: querying Win32_Product makes Windows Installer run a consistency check on every installed MSI package (may trigger self-repairs). For a quick list use the Registry query above.
Get-WmiObject -Class Win32_Product | select Name, Version, Vendor | Sort-Object -Property NameSearch installed Software-Packages
$str = Read-Host "Enter Package-Name (Part)"
Get-Package | Where-Object { $_.Name -like "*$str*" }remove installed Software (via WMI)
use Full name provided by the Get all installed Software section above
$pkgName = Read-Host "Enter the Package Name"
(Get-WmiObject -Class Win32_Product | Where-Object{$_.Name -eq "$pkgName"}).Uninstall()remove installed Software-Package
use Full name provided by the Search installed Software-Packages section above
$pkgName = Read-Host "Enter the Package Name"
Uninstall-Package -Name $pkgName -ConfirmRemove built-in / provisioned Apps
Provisioned apps are installed into every new user profile. List them:
Get-AppxProvisionedPackage -Online | Sort-Object DisplayName | Select-Object DisplayName, Version, PackageNameRemove an app for new profiles (provisioned) and for all existing profiles:
$app = Read-Host "Enter App-Name (Part), e.g. Xbox"
Get-AppxProvisionedPackage -Online | Where-Object DisplayName -like "*$app*" | Remove-AppxProvisionedPackage -Online -AllUsers
Get-AppxPackage -AllUsers -Name "*$app*" | Remove-AppxPackage -AllUsersCareful: run the list first and use a specific name. Never remove framework/system packages (e.g. VCLibs, NET.Native, UI.Xaml, DesktopAppInstaller, WindowsStore).
Feature updates may re-provision some inbox apps.
Bulk Uninstall
Dangerous!
Uninstall All Packages from a Specific Vendor:
Github (halatsWol): bulkUninstall.ps1
Microsoft Support and Recovery Assistant (cmd-based)
(OffScrub)
Removes all MS Office installations and Residuals
Download Assistant from: https://aka.ms/SaRA_EnterpriseVersionFiles
Documentation: https://aka.ms/SaRA_CommandLineVersion
- Download Assistant
- Extract the files (e.g. to C:\Temp\)
- Open CMD as Admin
- Change to the directory where the files are located (e.g. ” cd ‘C:\Temp\GetHelpCmd_141543631\’ “)
- Run the following command:
.\GetHelpCmd.exe -S OfficeScrubScenario -AcceptEulaAutodesk Clean-Uninstall
Manual uninstall – Autodesk Documentation: How to perform a Clean Uninstall of Autodesk products on Windows
Automated Uninstall:
Autodesk Fusion is not uninstalled by the script, but its files get deleted: uninstall Fusion manually first.
The script removes the Autodesk data of every user profile (incl. customisations under AppData\Roaming\Autodesk) and clears every profile’s %TEMP%.
Download the Script from Github: AutoDeskCleanRemove.ps1
(e.g. move to C:\Temp\ )
or directly download it into the Temp Folder using Powershell:
New-Item -ItemType Directory -Path C:\Temp -Force | Out-Null
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/halatsWol/PowerShell-Tools/main/scripts/AutoDeskCleanRemove.ps1" -OutFile "C:\Temp\AutoDeskCleanRemove.ps1"- open Powershell as Administrator
- Navigate to the Folder where the Script is located using
cd C:\Temp\ - allow scripts for this PowerShell session only (confirm with ‘Y’):
Set-ExecutionPolicy -Scope Process Bypass(optional) dry run first, shows everything that would be removed and changes nothing:
.\AutoDeskCleanRemove.ps1 -WhatIf- Execute the Script
.\AutoDeskCleanRemove.ps1- The script lists the Autodesk products found and an estimated duration (about 1.5 min per GB installed, Revit takes far longer than small products). Close all Autodesk applications, read the warnings and continue with [Enter].
OneDrive may warn about deleted files (Autodesk example files and projects) >> simply accept the deletion. Several windows may appear: don’t close them, the script closes them itself.
- Once the removal has completed, the user will be notified (Windows Notification). The PowerShell window lists anything that could not be removed.
Log and registry backup:C:\_ADSK_CleanUninstall\
- Restart the device (answer
Y): the remaining cleanup runs during the restart, before anyone signs in, and then removes itself
Unattended (Intune, SCCM): no prompts, restarts right away so the boot-time cleanup finishes immediately
.\AutoDeskCleanRemove.ps1 -Unattended -ForceRestartReturn codes: 0 done | 3010 done, a restart finishes the cleanup | 10 done, but a forced Windows Installer cleanup was needed: restart required (map it to Soft reboot in Intune/SCCM) | 1 not elevated or items left (see log)
General Software Repair
Office
Office 365 General
Office File Cache
Office File Cache is used to store files that are used by Office Applications. If office does not work properly these file will not be cleared when Closing the Office-Document. This may cause “File in use” issues
clear Cache via Office > File > Options > Save > Cache Settings > Delete Cached Files. Double check the path below if it is empty
Additionally set in Office > File > Options > Save > Cache Settings > Delete files from the Office Document Cache when they are closed
Cache Location:
%LOCALAPPDATA%\Microsoft\Office\16.0\OfficeFileCacheOffice repair
Start-Process -FilePath "$env:CommonProgramFiles\Microsoft Shared\ClickToRun\OfficeClickToRun.exe"`
-ArgumentList "scenario=Repair", "platform=x64", "culture=en-us", 'DisplayLevel=False' -Waitcd "%CommonProgramFiles%\Microsoft Shared\ClickToRun\"
OfficeClickToRun.exe scenario=Repair platform=x64 culture=en-us DisplayLevel=FalseOffice x86 to x64 upgrade
When upgrading Microsoft Office 365 from x86 to x64 Architecture, it may happen that a Registry Entry is not removed which points to the Program Files x86 Path.
This may cause 3rd Party Software which communicates with MS Office to throw Errors
$regPath = 'HKLM:\Software\Classes\TypeLib\{00062FFF-0000-0000-C000-000000000046}\9.6\0\Win32'
if (Test-Path $regPath) {
try {
Remove-Item -Path $regPath -Recurse -Force
Write-Host 'The "Win32" folder has been successfully deleted from the registry.'
} catch {
Write-Host "An error occurred while trying to delete the 'Win32' folder: $_"
}
} else {
Write-Host 'The "Win32" folder does not exist in the specified registry path.'
}Office update (cmd/PS)
to update MS Office via Shell using the Click to Run Client
start-process "C:\Program Files\Common Files\microsoft shared\ClickToRun\OfficeC2RClient.exe" -ArgumentList "/update user"cd "C:\Program Files\Common Files\microsoft shared\ClickToRun\"
.\OfficeC2RClient.exe /update userRepair Word-Registry
use when Word does not start or crash on start
This will not repair the Word, but may fix issues with the Windows-Registry. Only works with Word…
winword.exe /rOffice 365 EXE names:
| Word | winword.exe |
| Excel | excel.exe |
| PowerPoint | powerpnt.exe |
| Outlook | outlook.exe |
| OneNote | onenote.exe |
| Access | msaccess.exe |
Outlook
Outlook switches
| Safe Mode | outlook.exe /safe |
| Clean Views | outlook.exe /cleanviews |
| Profile Prompt | outlook.exe /profiles |
| Clean Rules use when the Rules-Button in File>Account-Settings>Delegate-Access throws an error /cleanrules removes all rules on client and server! | |
| delete Rules on Client | outlook.exe /cleanclientrules |
| delete Rules on Server | outlook.exe /cleanserverrules |
| delete All Rules | outlook.exe /cleanrules |
Other Outlook Switches
| reset Folder Names | outlook.exe /ResetFolderNames |
| reset Folders | outlook.exe /ResetFolders |
| reset Ribbon | outlook.exe /ResetOutlookBar |
| reset Navigation | outlook.exe /ResetNavPane |
| clear ItemProcSearch1 | outlook.exe /cleanips |
- Clears the ItemProcSearch Folder, when messages are stuck in the item processing pipeline (e.g. Outbox-Queue) ↩︎
SCCM
Clear CCM-Cache
Remove-Item -Recurse -Force -ea SilentlyContinue "C:\Windows\ccmcache\*"Repair SCCM (local)
Log-Location: C:\Windows\ccmsetup\Logs\ccmsetup.log
Setup will end in CcmSetup is exiting with return code #
# = 0 -> Setup Successful
# = 7 -> Restart Required (will continue/finalize repair/install after the restart)
Any other value is usually an error and needs investigation
Start-Process -Wait C:\Windows\CCM\ccmrepair.execd %WinDir%\CCM\
.\ccmrepair.exeSCCM – Repair (remote)
function SCCM-RepairClient([String] $CompName) {
$SCCMClient = [wmiclass] "\\$CompName\root\ccm:sms_client"
$SCCMClient.RepairClient()
}
$ComputerName=Read-Host "`r`nSCCM-Client Repair:`r`n-------------------`r`nEnter Computername"
SCCM-RepairClient -CompName "$ComputerName"Un-install SCCM
Log-Location: Same as in repair above
Start-Process -Wait "C:\Windows\CCMSetup\CCMSetup.exe" -ArgumentList "/uninstall"Re-Install SCCM
Site-Code = 3-character code to specify the SCCM-Site, such as AA0, CXX, P01
If no site code is provided, SCCM will automatically search in the network and use the first one found
Log-Location: Same as in repair above
$siteCode = Read-Host "Enter the SCCM Site-Code"
Start-Process "C:\Windows\CCMSetup\ccmsetup.exe" -ArgumentList "SMSSITECODE=$siteCode"Hint: in most cases this works best when done directly from the Backend via Configuration Manager console > Right-Click on Device > Install Client
(Select ‘Always install the Client Software’, ‘Uninstall existing …’ & ‘Install the Client Software from a specified Site’)
Start SCCM Client Actions
$SCCMActions = @{
"Hardware Inventory Cycle" = "{00000000-0000-0000-0000-000000000001}"
"Software Inventory Cycle" = "{00000000-0000-0000-0000-000000000002}"
"Discovery Data Collection Cycle" = "{00000000-0000-0000-0000-000000000003}"
"File Collection Cycle" = "{00000000-0000-0000-0000-000000000010}"
"Machine Policy Retrieval & Evaluation Cycle" = "{00000000-0000-0000-0000-000000000021}"
"Software Metering Usage Report Cycle" = "{00000000-0000-0000-0000-000000000031}"
"Windows Installer Source List Update Cycle" = "{00000000-0000-0000-0000-000000000032}"
"Software Updates Scan Cycle" = "{00000000-0000-0000-0000-000000000113}"
"Software Updates Deployment Evaluation Cycle" = "{00000000-0000-0000-0000-000000000108}"
"Application Deployment Evaluation Cycle" = "{00000000-0000-0000-0000-000000000121}"
}
foreach ($Action in $SCCMActions.GetEnumerator()) {
Write-Host "Running: $($Action.Key)"
Invoke-WmiMethod -Namespace "root\ccm" -Class SMS_Client -Name TriggerSchedule -ArgumentList $Action.Value | Out-Null
}
Write-Host "All SCCM Client Actions triggered."Automated Repair (incl. Scans and reset)
# Restart SCCM Client Service
Write-Host "Restarting SCCM Service..."
Stop-Process -Name SCClient,CcmExec -Force -ErrorAction SilentlyContinue
Restart-Service CcmExec -Force -ErrorAction SilentlyContinue
Start-Sleep -Seconds 10
# Run SCCM Client Repair
Write-Host "Running SCCM Client Repair..."
Start-Process "C:\Windows\CCM\ccmrepair.exe" -Wait -ErrorAction Stop -NoNewWindow
# Print Repair Result
$ccmSetupLogFolder = "C:\Windows\ccmsetup\Logs"
$ccmsetupLogFile="ccmsetup.log"
if (Test-Path $ccmsetupLogFolder\$ccmsetupLogFile) {
$logLines = Get-Content -Path $ccmsetupLogFolder\$ccmsetupLogFile -Tail 3
foreach ($line in $logLines) {
if ($line -match "<!\[LOG\[(.*?)\]LOG\]!>") {
$logMessage = $matches[1]
# only print if logmessage starts with "CcmSetup is exiting with return code"
if ($logMessage -like "CcmSetup is exiting with return code*" -or $logMessage -like "CcmSetup failed with error code*") {
Write-Host "Log Message: $logMessage"
}
}
}
}
# Clear SCCM Cache
Write-Host "Clearing SCCM Cache..."
$CachePath = "C:\Windows\ccmcache\*"
If (Test-Path $CachePath) {
Remove-Item $CachePath -Recurse -Force -ErrorAction SilentlyContinue
}
# Trigger SCCM Cycles
Write-Host "Triggering SCCM Client Actions..."
$Schedules = @(
"{00000000-0000-0000-0000-000000000021}", # Machine Policy Retrieval
"{00000000-0000-0000-0000-000000000022}", # Machine Policy Evaluation
"{00000000-0000-0000-0000-000000000113}", # Software Update Scan
"{00000000-0000-0000-0000-000000000108}", # Software Update Deployment Eval
"{00000000-0000-0000-0000-000000000121}" # Application Deployment Eval
)
foreach ($Schedule in $Schedules) {
Invoke-WmiMethod -Namespace "root\ccm" -Class SMS_Client -Name TriggerSchedule -ArgumentList $Schedule | Out-Null
}
# Wait for Scans to complete
$WaitTime = 15
Write-Host "Waiting for $WaitTime minutes to complete Scans"
Start-Sleep -Seconds ($WaitTime *60)
Write-Host "Restarting Software Center..."
Stop-Process -Name SCClient -Force -ErrorAction SilentlyContinue
Start-Process "C:\Windows\CCM\ClientUX\SCClient.exe"Uninstall SCCM
Start-Process -FilePath "C:\Windows\CCMSetup\ccmsetup.exe" -ArgumentList"/uninstall" -Wait -ErrorAction Stop -NoNewWindowModern Apps
MS-Teams
Cache Location:
%LOCALAPPDATA%\Packages\MSTeams_8wekyb3d8bbwe\LocalCacheOneDrive Reset
To reset the current sync profile and cache run the following:
C:\Program Files\Microsoft OneDrive\OneDrive.exe /resetActive Directory
Search User by PhoneNr
$number = Read-Host -Prompt "What is the mobile phone number you are looking for"
Write-Host "`r`nStarting Search.`r`nProcess will stop if a match is found.`r`nTo cancel Press 'Ctrl+C'."
$number = $number -replace '[^0-9]' # Normalize input
$match = Get-ADUser -Filter * -Properties MobilePhone, HomePhone, OfficePhone, DisplayName, sAMAccountName |
Select-Object DisplayName, sAMAccountName, MobilePhone, OfficePhone, HomePhone |
Where-Object {
($_.MobilePhone -replace '[^0-9]' -like "*$number*") -or
($_.OfficePhone -replace '[^0-9]' -like "*$number*") -or
($_.HomePhone -replace '[^0-9]' -like "*$number*")
} | Select-Object -First 1
if ($match) {
Write-Host "`r`nMatch found:`r`n$match"
} else {
Write-Host "`r`nNo match found."
}List all Groups, a user is member of
$user=read-host "enter username"
((Get-ADUser $user -Properties MemberOf ).MemberOf.split(",")| where-object {$_.contains("CN=")}).replace("CN=","")Add a User to a Group
$user=read-host "enter username"
$adGroup=Read-Host "Enter User-Group name"
Add-ADGroupMember -Identity $adGroup -Members $userCompare Usergroup Membership
Compares 2 users and lists the ‘Member of’-Groups that are missing on User1
$user1=read-host "enter username User1"
$user2=read-host "enter username User2"
$users = $user1, $user2
$user1Groups = ((Get-ADUser $users[0] -Properties MemberOf).MemberOf.split(",") | where-object { $_.contains("CN=") }).replace("CN=", "")
$user2Groups = ((Get-ADUser $users[1] -Properties MemberOf).MemberOf.split(",") | where-object { $_.contains("CN=") }).replace("CN=", "")
$missingInUser1 = $user2Groups | Where-Object { $user1Groups -notcontains $_ }
Write-Host "`r`n`r`n`r`nFollowing groups are missing for $user1 :"
$missingInUser1List Groups in a specific OU
with $searchBase specify the path in reverse order.
if the OU location is part of company.com then enter: OU=location,DC=company,DC=com
$searchBase=read-host "enter OU path in reverse Order"
Get-ADObject -Filter 'objectClass -eq "group"' -SearchBase $searchBase -Properties DistinguishedName, ManagedBy, Description | ForEach-Object {
$groupCN = $_.DistinguishedName.split(",") | Where-Object { $_.contains("CN=") } | ForEach-Object { $_.replace("CN=", "") }
$owner = if ($_.ManagedBy) { (Get-ADUser -Identity $_.ManagedBy).SamAccountName } else { "No owner" }
[PSCustomObject]@{
GroupCN = $groupCN
Description = $_.Description
Owner = $owner
}
} | Group-Object Owner | ForEach-Object {
Write-Output "Owner: $($_.Name)"
$_.Group | ForEach-Object {
Write-Output " - Group: $($_.GroupCN)"
Write-Output "Description: $($_.Description)"
Write-Output ""
}
Write-Output ""
}Network commands
Network Configuration Info
ipconfig /allTest TCP Connection
Test-NetConnection -RemoteAddress example.com -RemotePort 443renew DNS
ipconfig /flushdns
ipconfig /registerdnsrenew IP (dhcp)
ipconfig /release
ipconfig /renewIP/Hostname resolve
resolves Hostname/Webdomain to its IP address and vice versa
additionally shows the resolving Nameserver that handled the request
nslookup <hostname/domain/IP-Address>Follow request path
lists the IP-Addresses of Devices/Servers that handle your request
tracert <domain/IP-Address>list devices in local Network
lists the known MAC-Addresses of Devices in the local Network with the dedicated IP-Address
arp -aWho Is
shows the ‘WhoIs’ information (owner-information)of a domain
whois <domain>Info
Official Domains (eg. microsoft.com) have the WhoIs information public.
This information may indicate that a mail/Website might be malicious
Attention: the WhoIs information is provided by the Domain-Owner. Therefore it may be false!
WhoIs Information may indicate a malicious domain, but never that it is safe!
WhoIs Information may be redacted for privacy reasons. This may be for ‘safe’ private Domains and malicious ones!
WhoIs is not part of Windows
download from Microsoft SysInternals | WhoIs
either copy whois.exe to C:\Windows\system32\ or go to the whois.exe-location in CMD by entering cd <Directory-Path-to-whois.exe>
show known Networks
netsh wlan show profilesshow Wifi Interfaces
netsh wlan show interfacesChange Wifi Priority
netsh wlan set profileorder name="NETWORK-PROFILE-NAME" interface="YOUR-INTERFACE-NAME" priority=1connect to Remote PowerShell
Enter-PSSession -ComputerName <remote-ComputerName>Listening Ports:
List listening TCP-Ports
mkdir -force C:\_temp
Get-NetTCPConnection -State Listen | Tee-Object -file C:\_temp\tcp_all.logList listening UDP-Ports
mkdir -force C:\_temp
Get-NetUDPEndpoint | Tee-Object -file C:\_temp\udp_all.logFind the Process using a specific Port
To Search UDP-Ports used for a specific IP, change -LocalPort to -LocalAddress
mkdir -force C:\_temp
$port= Read-Host "Enter the Port-Number"
Get-NetUDPEndpoint -LocalPort $port | Select-Object LocalAddress,LocalPort,OwningProcess,@{
Name="ProcessName"
Expression={((Get-Process -Id $_.OwningProcess).Name )}
} | Tee-Object -file "C:\_temp\udp_$port.log"TCP:
mkdir -force C:\_temp
$port= Read-Host "Enter the Port-Number"
Get-NetTCPConnection -LocalPort $port | Select-Object LocalAddress,LocalPort,RemoteAddress,RemotePort,State,OwningProcess,@{
Name="ProcessName"
Expression={((Get-Process -Id $_.OwningProcess).Name )}
} | Tee-Object -file "C:\_temp\tcp_$port.log"new Windows Profile
Automated
Download the Script from Github: removeUserProfile.ps1
(e.g. move to C:\Temp\ )
or directly download it into the Temp Folder using Powershell:
New-Item -ItemType Directory -Path C:\Temp -Force | Out-Null
Invoke-WebRequest -Uri "https://raw.githubusercontent.com/halatsWol/PowerShell-Tools/main/scripts/removeUserProfile.ps1" -OutFile "C:\Temp\removeUserProfile.ps1"- Restart Device & Log in as different user (Admin)
- open Powershell as Administrator
- Navigate to the Folder where the Script is located using
cd C:\Temp\ - allow scripts for this PowerShell session only (confirm with ‘Y’):
Set-ExecutionPolicy -Scope Process Bypass- Execute the Script
.\removeUserProfile.ps1or directly with the username(s): .\removeUserProfile.ps1 -UserName jdoe
- select the profile(s) by number or username (e.g.
1,3-5,jdoe) and confirm withY: the profile folder is renamed toC:\Users\<User>-<Date>.old(typeDELETEinstead to delete it permanently)
profiles of users who are still signed in (or have processes running) are skipped - if something was locked, the script offers a restart: the rest is finished during that restart
- let the User sign in with their Account
- Log and backups are in
C:\_IT-ProfileCleanup\<Timestamp>_ProfileCleanup\(one subfolder per profile)
Network-Drives can be remapped by runningNetDrives_<UserName>.cmdas the user
installed Printers are listed inPrinterList_<UserName>.txt - copy relevant data from the old profile folder (
C:\Users\<User>-<Date>.old) to the new profile-Folder (Documents, Pictures, etc. … if they are not synced via OneDrive or similar)
Manual
- with the user still signed in, make a Screenshot of the Mapped Network-Drives and Printers
- Restart Device & Log in as different user (Admin)
- open the following path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList- here you will find at least one Key (Folder) named something like S-1-5-21-3552239657-3581867678-65225843-1001
look through the Keys in ProfileList and look in each under ProfileImagePath for the User - get the Name of the Key (=SID) and copy it aside (e.g. into Editor)
- go right-click in the Registry on the Key > Export
- delete the SID-Key in ProfileList (the whole folder)
- (only if available) in HKEY_USERS look again for the Keys containing the SID-Key (also the one ending in <SID-Key>_classes)
select each Key, go to in the Registry Window > File & click on Unload Hive… - In Explorer: rename User folder C:\Users\<username> to C:\Users\<username>.OLD
- Restart the device
- let user Login again
- set up printer, network Drives etc
- copy relevant data from old profile to new profile-Folder (Documents, Pictures, etc. … if they are not synced via OneDrive or similar)
- delete old profile Folder
following directories may be relevant to copy from old Profile:
only copy if they are not (part of) the reason why a new Profile has been created
- Sticky-Notes:
C:\Users\<UserName>\AppData\Roaming\Microsoft\Sticky Notes - WSL:
in the following path: C:\Users\<UserName>\AppData\Local\Packages\
WSL will be stored in folders depending on the OS used…
e.g. Ubuntu will be in a Folder named something like CanonicalGroupLimited.Ubuntu22.04LTS_79rhkp1fndgsc\
Windows Features & Languages
Get all features
Get-WindowsOptionalFeature -Online | Sort-Object FeatureName | Format-Table FeatureName, Statedism /online /get-features /format:tableInstall feature
-All / /All also enables required parent features
if the State says Pending, a reboot is needed
$feature = Read-Host "Enter the Feature Name"
Enable-WindowsOptionalFeature -Online -FeatureName $feature -All -NoRestart
Get-WindowsOptionalFeature -Online -FeatureName $feature | Select-Object FeatureName, Stateset /p feature=Enter the Feature Name:
Dism /online /Enable-Feature /FeatureName:%feature% /All /norestart /quiet
Dism /online /Get-FeatureInfo /FeatureName:%feature%Disable feature
if the State says Pending, a reboot is needed
$feature = Read-Host "Enter the Feature Name"
Disable-WindowsOptionalFeature -Online -FeatureName $feature -NoRestart
Get-WindowsOptionalFeature -Online -FeatureName $feature | Select-Object FeatureName, Stateset /p feature=Enter the Feature Name:
Dism /online /Disable-Feature /FeatureName:%feature% /norestart /quiet
Dism /online /Get-FeatureInfo /FeatureName:%feature%Common Feature Names
| .NET Framework 3.5 (incl. 2.0) | NetFx3 |
| .NET Framework 4.x WCF HTTP Activation | WCF-HTTP-Activation45 |
| Hyper-V (all) | Microsoft-Hyper-V-All |
| Hyper-V Management Tools only | Microsoft-Hyper-V-Tools-All |
| Virtual Machine Platform | VirtualMachinePlatform |
| Windows Hypervisor Platform (3rd party VMs, e.g. VirtualBox/VMware next to Hyper-V) | HypervisorPlatform |
| WSL | Microsoft-Windows-Subsystem-Linux + VirtualMachinePlatform (or wsl --install) |
| Windows Sandbox | Containers-DisposableClientVM |
| Containers | Containers |
| Telnet Client | TelnetClient |
| TFTP Client | TFTP |
| SMB 1.0 (insecure, disable) | SMB1Protocol |
| SMB Direct | SmbDirect |
| NFS Client | ServicesForNFS-ClientOnly + ClientForNFS-Infrastructure |
| IIS | IIS-WebServerRole |
| Microsoft Print to PDF | Printing-PrintToPDFServices-Features |
| Microsoft XPS Document Writer | Printing-XPSServices-Features |
| Internet Printing Client | Printing-Foundation-InternetPrinting-Client |
| LPR Port Monitor | Printing-Foundation-LPRPortMonitor |
| Media Features (Windows Media Player legacy, N editions) | MediaPlayback |
| Legacy Components: DirectPlay (old games/apps) | DirectPlay |
| MSMQ (Message Queuing) | MSMQ-Container |
| Work Folders Client | WorkFolders-Client |
| PowerShell 2.0 (legacy, disable) | MicrosoftWindowsPowerShellV2Root |
.NET Framework 3.5 offline install
when Windows Update / WSUS can’t deliver it: mount the Windows ISO (same version) and adjust the drive letter
Enable-WindowsOptionalFeature -Online -FeatureName NetFx3 -All -Source D:\sources\sxs -LimitAccessDism /Online /Enable-Feature /FeatureName:NetFx3 /All /Source:D:\sources\sxs /LimitAccessCapabilities (Features on Demand)
List Capabilities
installed capabilities:
Get-WindowsCapability -Online | Where-Object State -eq Installed | Select-Object NameDism /Online /Get-Capabilities /Format:TableInstall Capability
$cap = Read-Host "Enter the Capability Name (Part), e.g. OpenSSH.Client"
Get-WindowsCapability -Online -Name "*$cap*" | Where-Object State -ne Installed | Add-WindowsCapability -OnlineInstall from a FOD image (no internet / WSUS): mount the Languages and Optional Features ISO of the same Windows build (e.g. as D:) and add to the command:
PowerShell: -Source D:\LanguagesAndOptionalFeatures -LimitAccess
DISM: /Source:D:\LanguagesAndOptionalFeatures /LimitAccess
(Windows 10 FOD ISOs have the files in the root: D:\)
Common Capabilities
| RSAT Active Directory | Rsat.ActiveDirectory.DS-LDS.Tools~~~~0.0.1.0 |
| RSAT Group Policy | Rsat.GroupPolicy.Management.Tools~~~~0.0.1.0 |
| RSAT DNS / DHCP | Rsat.Dns.Tools~~~~0.0.1.0 / Rsat.DHCP.Tools~~~~0.0.1.0 |
| RSAT BitLocker Recovery (AD) | Rsat.BitLocker.Recovery.Tools~~~~0.0.1.0 |
| RSAT Server Manager | Rsat.ServerManager.Tools~~~~0.0.1.0 |
| OpenSSH Client / Server | OpenSSH.Client~~~~0.0.1.0 / OpenSSH.Server~~~~0.0.1.0 |
| WMIC | WMIC~~~~ |
| SNMP Client | SNMP.Client~~~~0.0.1.0 |
| Print Management Console | Print.Management.Console~~~~0.0.1.0 |
| Graphics Tools (DirectX diagnostics) | Tools.Graphics.DirectX~~~~0.0.1.0 |
| XPS Viewer | XPS.Viewer~~~~0.0.1.0 |
install all RSAT tools:
Get-WindowsCapability -Online -Name RSAT* | Where-Object State -ne Installed | Add-WindowsCapability -OnlineXPS-Viewer
dism /Online /Add-Capability /CapabilityName:XPS.Viewer~~~~0.0.1.0Languages
Show installed Languages
Windows 11 22H2+ / Server 2025 (module LanguagePackManagement), run as Admin
Get-InstalledLanguageInstall a Language
installs the language pack incl. its Features on Demand (basic typing, handwriting, OCR, speech)
add -CopyToSettings to also make it the system display language
$lang = Read-Host "Enter the Language Tag, e.g. de-DE"
Install-Language -Language $langSet Display Language & Region
sign out & back in afterwards
Set-SystemPreferredUILanguage -Language de-DE # system default (new users, Welcome screen)
Set-WinUILanguageOverride -Language de-DE # display language of the current user
Set-Culture de-AT # formats (date, number, currency)
Set-WinHomeLocation -GeoId 14 # region / home location (14 = Austria)Add Keyboard / Input Language
for the current user
$list = Get-WinUserLanguageList
$list.Add("de-AT")
Set-WinUserLanguageList $list -ForceCopy Language Settings to Welcome Screen & new Users
same as Settings > Time & language > Language & region > Administrative language settings > Copy settings
Copy-UserInternationalSettingsToSystem -WelcomeScreen $true -NewUser $trueRemove a Language
Uninstall-Language -Language fr-FRFeatures / Languages fail to install (WSUS)
Optional Features, Capabilities and Languages can’t be downloaded when the device gets its updates from WSUS/SCCM (error 0x800f0954).
Fix via Group Policy: Computer Configuration > Administrative Templates > System > Specify settings for optional component installation and component repair > Enabled + Download repair content and optional features directly from Windows Update instead of Windows Server Update Services (WSUS).
Run gpupdate /force, then retry.
Alternative without Windows Update: FOD image
Mount the Languages and Optional Features ISO of the same Windows build (e.g. as D:) and install with -Source D:\LanguagesAndOptionalFeatures -LimitAccess (see Capabilities > Install Capability).
For many devices: copy the ISO content to a share and set it in the same policy as Alternate source file path (e.g. \\server\FOD\LanguagesAndOptionalFeatures).
Language from the FOD image (language pack first, then its capabilities):
$lang = Read-Host "Enter the Language Tag, e.g. de-DE"
$fod = "D:\LanguagesAndOptionalFeatures"
Add-WindowsPackage -Online -PackagePath "$fod\Microsoft-Windows-Client-Language-Pack_x64_$($lang.ToLower()).cab"
Get-WindowsCapability -Online -Name "Language.*$lang*" | Where-Object State -ne Installed | Add-WindowsCapability -Online -Source $fod -LimitAccessWindows Tools
Windows Tools
Run Win+R to Execute
| Icon | Executable | Name | Description |
|---|---|---|---|
| cleanmgr.exe | Disk Cleanup Manager | Removes unnecessary files from your hard drive | |
| compmgmt.msc | Computer Management | Provides a centralized console for managing system components. | |
| control.exe | Control Panel | a central hub for system settings | |
| control.exe keymgr.dll | Credential Manager | Manage stored Login Credetials | |
| control.exe smscfgrc | SCCM Configruation Manager Properties | clear Cache, Trigger Scans and read properties of Configuration Manager | |
| desk.cpl | Display Settings (new) | Set up and customize Display Resolution, Position, etc. | |
| devmgmt.msc | Device Manager | Manages hardware devices | |
| diskmgmt.msc | Disk Management | for managing disk partitions and volumes. | |
| dxdiag.exe | DirectX Diagnostic Tool | Diagnoses DirectX-related issues and provides system information. | |
| eventvwr.msc | Event Viewer | Logs system events, errors, and warnings | |
| gpedit.msc | Group Policy Editor | Configures group policies | |
| gpedit.msc /gpcomputer: RemoteDevice | Group Policy Editor (remote) | Configures group policies on a remote device, current user (or user running shell/commandline) requires Admin permissions on the remote device | |
| inetcpl.cpl | Internet Properties | Configures Internet Explorer settings | |
| intl.cpl | Region | Win95 Region and Format Settings | |
| lusrmgr.msc | Local Users and Groups | Manages local user accounts and groups | |
| mdsched.exe | Memory Diagnostic Scheduler | Diagnoses memory issues | |
| mmc.exe | Microsoft Management Console | A framework for managing various system components | |
| mmsys.cpl | Multimedia Control Panel | for configuring audio and video devices. | |
| msconfig.exe | System Configuration | Configures system startup settings | |
| msdt.exe | Diagnostic tool | used for various hardware and software troubleshooting. | |
| msinfo32.exe | System Information | Provides detailed information about system hardware and software | |
| ncpa.cpl | Network Connections (Network Adapters) | Folder for all network Adapters, used for Adapter-specific Network-Configuration | |
| netstat.exe | Network Statistics | for viewing network connections and statistics (CMD Tool). | |
| perfmon.exe | Performance Monitor | Monitors system performance metrics | |
| perfmon.exe /rel | Reliability Monitor | Tracks system reliability and helps identify and resolve common issues. | |
| printmanagement.msc | Print Management | Administrative tool to manage, configure, and troubleshoot network printers and drivers. | |
| regedit.exe | Registry Editor | for editing the Windows Registry | |
| resmon.exe | Resource Monitor | Provides a real-time view of system resource usage, including CPU, memory, disk, and network activity | |
| secpol.msc | Local Security Policy | Configures security settings | |
| services.msc | Services | for managing system services | |
| sysdm.cpl | System Properties | Provides system information and settings | |
| taskmgr.exe | Task Manager | for monitoring system performance and processes | |
| taskschd.msc | Task Scheduler | for managing planned and reoccurring Tasks | |
| timedate.cpl | Date and Time | Win95 Date and Time Settings | |
| winver.exe | Windows Version | Displays Windows version and build information. |
Alphabet
English
A Alpha | B Beta | C Ceasar/Charly | D Delta | E Echo |
F Foxtrott | G Golf | H Hotel | I India | J Juliet |
K Kilo | L Lima | M Mike | N November | O Oscar |
P Papa | Q Quebec | R Romeo | S Sierra | T Tango/Tokio |
U Uniform | V Victor | W Whiskey | X X-Ray | Y Yankee |
Z Zulu |
|
|
|
|
German
A Anton | B Berta | C Cäsar | D Dora | E Emil |
F Friedrich | G Gustav | H Heinrich | I Ida | J Julius |
K Konrad | L Ludwig | M Marta | N Nordpol | O Otto |
P Paula | Q Quelle | R Richard | S Siegfried | Sch Schule |
T Theotor | U Ulrich | V Viktor | W Wilhelm | X Xaver |
Y Ypsilon | Z Zeppelin | Ä Ärger | Ö Ökonom | Ü Übermut |


