Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade
Managing Windows updates is a crucial task for maintaining the security and performance of your system. Windows provides several tools and commands to manage updates, both through the graphical user interface and command-line interfaces like CMD and PowerShell. This article will guide you on how to manage Windows updates using CMD and PowerShell, providing practical examples and commands.
Examples:
Checking for Updates via CMD:
Although CMD does not have a direct command to check for updates, you can utilize Windows Update Agent API commands through the Windows Management Instrumentation Command-line (WMIC).
wmic qfe list brief /format:table
This command lists all installed updates on your Windows machine. However, it does not check for new updates.
Checking for Updates via PowerShell:
PowerShell provides more robust capabilities for managing Windows updates. You can use the PSWindowsUpdate
module to check for and install updates.
First, you need to install the module:
Install-Module -Name PSWindowsUpdate -Force
Then, you can check for available updates:
Get-WindowsUpdate
Installing Updates via PowerShell:
After checking for updates, you can install them using:
Install-WindowsUpdate -AcceptAll -AutoReboot
This command installs all available updates and automatically reboots the system if necessary.
Scheduling Updates via Task Scheduler:
You can use Task Scheduler to automate the process of checking and installing updates. Here’s how you can create a task using CMD:
schtasks /create /tn "CheckForUpdates" /tr "powershell.exe -Command \"Get-WindowsUpdate | Install-WindowsUpdate -AcceptAll -AutoReboot\"" /sc daily /st 02:00
This command schedules a task named "CheckForUpdates" to run daily at 2 AM.