Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

PowerShell - Setting targetAddress Active Directory attribute for all computers listed in CSV file

$
0
0

Hi,

I would like to add all the individual MAC addresses for each corresponding computer account in Active Directory through PowerShell. The list has already been created in a CSV file.

The column headers in the CSV file are as followed:

sAMAccountName,targetAddress

I checked the info in the CSV file list and the computer names and their corresponding mac addresses are on the same line seperated by a comma, so the CSV file is correct. There are over 100 computers in the list.

I want to write all the MAC addresses to the targetAddress attribute of each of their corresponding computer in AD, but my command is not working.

Here is my command:

Import-Csv c:\updateAD.csv | Set-ADcomputer -Identity { $_.sAMAccountName } -add @{targetAddress = $_.targetAddress}

Can someone help with the syntax, or perhaps I must use a different algorithm ?

Kind Regards,


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>