Отключить компьютеры с помощью Powershell - PullRequest
0 голосов
/ 25 сентября 2018

У меня есть список из 150 компьютеров, которые я хотел бы отключить в активном каталоге с powershell.

Итак, у меня есть файл csv с computernames и следующим сценарием:

Import-Module ActiveDirectory

$computers = import-csv "C:\temp\test.csv"
foreach ($computer in $computers)
{
$computer | disable-adaccount
$computer | move-adobject -targetpath "OU=Disabled computers, DC=domain, DC=com"
}

Возникают следующие ошибки:

Disable-ADAccount : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeli
ne input.

Может кто-нибудь помочь, пожалуйста?

Приветствия

1 Ответ

0 голосов
/ 25 сентября 2018

Попробуйте обычный параметр вместо канала: disable-adaccount $computer (При необходимости повторите это для другого вызова)

Также посмотрите на этот вопрос в Technet: Сценарий Powershell для отключения учетной записи ADна основе файла CSV

...