We have a list of email contacts with Customattribute1 set to a 6 digit number.
I will be provided with a list of these contacts in csv, some of the details may have changed, such as lastname, title and externalemailaddress.
I need to parse this CSV list line by line, picking out the PrimaryKey field from the CSV, matching to an existing Contact's CustomAttribute1, then for each, set the details of lastname, title and externalemailaddress.
So far I have this:
$contacts = Import-CSV c:\contacts\primarykeytest.csv
$contacts | foreach ( get-Recipient -filter{CustomAttribute1 -eq $_.primarykey } | set-contact -lastname $_.lastname$ )
Error is
Invoke-Command : Cannot bind parameter 'Filter' to the target. Exception setting "Filter": """ is not a valid operator.
So I replace $_primarykey with a number in the CSV "999999" and get this
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 pipeline input.
Here's the CSV that has the updates for each user:
SCHOOL,NAME,FIRSTNAME,LASTNAME,JOB,EMAIL,PRIMARYKEY
ATestAcademy,Jon Jones,Jon,Jon,Head of Heads,jon.jones@atestacademy.org,999999
ATestAcademy,Jenny Jones,Jenny, Jones,Executive PA,jenny.Jones@atestacademy.org,999998
ATestAcademy,Stoopy Stoops,Stoopy,Stoops,Janitor,stoopy.stoops@atestacademy.org,999997
ATestAcademy,Winston Churchill,Winston,Churchil,PM,theboss@atestcademy.org,999996
Any help, much appreciated.