I am trying to populate the attribute ExtensionAttribute7 with a CSV file. The CSV file has two columns: samAccountName and ExtensionAttribute7
I import the Active Directory module and have been trying this script:
Import-Csv C:\sam-eid.csv | ForEach-Object {
Set-ADUser $_.samAccountName -Replace @{ExtensionAttribute7=$._ExtensionAttribute7}}
This is the error return I am getting:
$._ExtensionAttribute7 : The term '$._ExtensionAttribute7' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and
try again.
At line:2 char:62
+ … mAccountName -Replace @{ExtensionAttribute7= $._ExtensionAttribute7}}
+ ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: ($._ExtensionAttribute7:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Any ideas? I've tried -Add instead of -Replace to no avail.
Best Answer
Try the following:
You may have a syntax issue
$._
versus$_.