How to Disable and Enable computers through PowerShell

Опубликовано: 12 Июль 2026
на канале: BineshTech
58
0

How to Disable and Enable computers through PowerShell?

=====================================================
#Use below commands to disable, enable or to get current status of the computers

Import-Module ActiveDirectory
$ComputerList = Get-Content -Path C:\temp\ToBeDisabled.txt
Foreach ($comp in $ComputerList)
{
Set-ADComputer -Identity $comp -Enabled $false
#Get-ADComputer -Identity $comp -Properties name,enabled | Select-Object name,enabled
}

Note: Below CMDLet will disable computer objects. To enable computer object, please replace $false to $true
Set-ADComputer -Identity $comp -Enabled $false