Question : Exchange 2007 powershell commands

I have the following syntax to add fifty contacts to the GAL as mail enabled contacts.

import-csv "c:\contacts.csv" | foreach { new-mailcontact -name $_.displayName -ExternalEmailAddress $_.targetaddress -org Contacts }

This works perfectly. However, I want to hide each contact from the exchange address lists and I also want to add each person to a distribution list that is already created. Does anybody know what switches or commands I need to add to accomplish these two extra tasks?

Thanks,

Justin

Answer : Exchange 2007 powershell commands

this is completely out of my head and was not tested but it shld work with a bit of syntax etc...

copy paste it in a ps1 file
1:
2:
3:
4:
5:
6:
7:
8:
$contacts = import-csv "c:\contacts.csv"

foreach ($c in $contacts)
{
   new-mailcontact -name $c.displayName -ExternalEmailAddress $c.targetaddress -org Contacts
   set-mailcontact $c.displayName -HiddenFromAddressListsEnabled:$true
   add-distributiongroupmember GroupName -member $c.displayName
}
Random Solutions  
 
programming4us programming4us