PowerShell: Modify Extension Attributes on a List of Hosts
Some of you may find this useful, I ran into this problem where I needed to set the value of an extension attribute on a number of hosts from a list. The following script should take care of that. At the end, it will let you know that the host is finished, it will output an error if one occurs.
import-module activedirectory
$machines = Get-Content "C:\PATH TO LIST\feedme.txt"
foreach($machinename in $machines)
{
Set-ADComputer $machinename -add @{extensionattribute10 = "VALUE IN THE EXTENSION ATTRIBUTE"}
write-host $machinename " is done."
}
2 thoughts on “PowerShell: Modify Extension Attributes on a List of Hosts”
ERROR: Insufficient access rights to perform this operation.
I am the domain admin, running the command “Set-ADcomputer -Identity $computer -Add @{extensionAttribute15 = “yo”}”
Ran the powershell as administrator
Any thought y m i failing?
Needed this. Thanks.