Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

How to Perform a Windows Update Using Command Line Tools

Updating Windows is a crucial task to ensure your system remains secure and runs smoothly. While most users are familiar with the graphical interface for updating Windows, it's also possible to perform updates using command line tools. This can be particularly useful for system administrators managing multiple machines or for users who prefer scripting and automation.

Examples:

Using Windows Update from the Command Line with PowerShell

PowerShell provides a powerful way to manage Windows updates. Here's how you can check for and install updates using PowerShell:

  1. Open PowerShell as Administrator:

    • Press Win + X and select "Windows PowerShell (Admin)" from the menu.
  2. Check for Updates:

    • Use the following command to check for available updates:
      Get-WindowsUpdate
  3. Install Updates:

    • To install all available updates, use the command:
      Install-WindowsUpdate -AcceptAll -AutoReboot
    • This command will automatically accept all updates and reboot the system if necessary.

Using Command Prompt with Windows Update Agent

While PowerShell is more versatile, you can also use the Command Prompt to initiate updates using the Windows Update Agent:

  1. Open Command Prompt as Administrator:

    • Press Win + R, type cmd, and press Ctrl + Shift + Enter to open Command Prompt with administrative privileges.
  2. Check for Updates:

    • Use the Windows Update Agent command-line tool:
      wuauclt /detectnow
    • This command forces Windows to check for updates immediately.
  3. Install Updates:

    • To install updates, use:
      wuauclt /updatenow
    • Note that this command may not provide feedback in the Command Prompt, but it will initiate the update process.

Scheduling Updates with Task Scheduler

For automation, you can schedule updates using Task Scheduler:

  1. Open Task Scheduler:

    • Press Win + S, type "Task Scheduler", and press Enter.
  2. Create a New Task:

    • In Task Scheduler, click "Create Basic Task" and follow the wizard to set up a task that runs the PowerShell update script at a specified time.
  3. Script Example:

    • Save the following script as UpdateScript.ps1:
      Install-WindowsUpdate -AcceptAll -AutoReboot
    • Schedule this script to run using Task Scheduler.

To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.