Mass Reboot of Windows Computers

 

To reboot all domain computers, you can use PowerShell with the Active Directory module. Before running this script, make sure you have the Active Directory module installed. If it's not installed, you can install it using the following command (run PowerShell as an administrator):

 

Install-WindowsFeature RSAT-AD-PowerShell

 

Once the module is installed, you can use the following PowerShell script to reboot all computers in your domain:

# Import the Active Directory module

Import-Module ActiveDirectory

 

# Get all domain computers

$computers = Get-ADComputer -Filter *

 

# Reboot each computer

foreach ($computer in $computers) {

    $computerName = $computer.Name

    Write-Host "Rebooting computer: $computerName"

    Restart-Computer -ComputerName $computerName -Force

}

 

Write-Host "All domain computers have been scheduled to reboot."

 

Please exercise caution while running this script, as it will forcefully reboot all computers without any prompt. Make sure you have appropriate permissions and consider notifying the users beforehand about the reboot to avoid any inconvenience.

Save the script with a .ps1 extension (e.g., RebootDomainComputers.ps1). To execute the script, open a PowerShell window as an administrator, navigate to the location where the script is saved, and run it:

.\RebootDomainComputers.ps1

Note: Rebooting all computers in a domain at once can have a significant impact on your network. Please use this script responsibly and only in situations where it's necessary. If you want to reboot specific computers or groups of computers, you can modify the script accordingly.

Popular posts from this blog

WSUS CVE-2025-59287 Mitigation

CVE-2025-58034 Fortinet Warnings and Mitigation

Cloud Infrastructures are Having a Bad Week