Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Create contacts frm CSV

$
0
0

Hi,

The following script

$Path =

 

 

'C:\csv\contacts.csv'

Import-Csv

$Path|ForEach-Object {New-ADObject-TypeContact-Path"OU=Contacts,OU=WLB,DC=Domain,DC=local"-Name"$_.DisplayName"-OtherAttributes @{'mail'=$_.ExternalEmailAddress;}}

Procuces the error below. Can someone please tell whats wrong with this

Many thanks

New-ADObject : Cannot bind parameter 'OtherAttributes' to the target. Exception setting "OtherAttributes": "Object reference not set to an

instance of an object."

At C:\Script\contacts.ps1:4 char:150

+ ... therAttributes @{'mail'=$_.ExternalEmailAddress;}}

 


Viewing all articles
Browse latest Browse all 8583

Trending Articles