the first part of the command "foreach {New-mailbox - .....etc" i used to create mailbox
and the second part of the command "| Set-Contact -Identity...... " is used to modify existing contact
you can't pipeline the commands the way u use as there are no relation between both
specify what do u need to exactly, create new mailboxes or modify existing contacts
dpdmembers
ASKER
Is the -Identity $_.contact in Set-Contact equivalent to -userprincipalname $_.userprincipalname of New-mailbox? Other wise how does it know which contact to update?
and you will see the entire content of the CSV file.
the foreach-loop simply goes through each row or object from the previous command that you specify.
$_.Contact in a foreach loop is the value of the column "Contact" on the current Row. The part behind the "$_." is the value of the header for that column in your CSV-table.