• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1087
  • Last Modified:

Set DL Delivery Restrictions in Shell

Exchange 2010 Shell


Hello all, I need to add several names in the Accept Messages pane under Message Delivery Restrictions thru the shell.

In Excel
  row1 column header: name
  row2:  last, first name1
  row3:  last, first name2

I have varied from Alias, Email Address, and Last, First name formats in excel.

My command I'm using is
Import-Csv "C:\xxx\xxx.csv" | ForEach{Set-DistributionGroup -Identity "xxx" –AcceptMessagesOnlyFromSendersorMembers -User$_.Name}

I'm getting the error "A positional parameter cannot be found that accepts argument"
I'm getting this regardless of the format in Excel.
0
GJohn32
Asked:
GJohn32
  • 6
  • 6
1 Solution
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Check if this article can help you

http://www.networksteve.com/exchange/topic.php?TopicId=23572

import-csv -Path "c:\group1234.csv" | Foreach-object {Set-DistributionGroup -Identity $_.Identity –AcceptMessagesOnlyFromSendersorMembers -User$_.Name}

Please try with one or just a few DL's

- Rancy
0
 
GJohn32Author Commented:
Thank you, I did not see anything on DL restrictions on the website.

Right now I am only testing two user names in the Excel.
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
It wasnt there on the site i changed it a bit as per your needs just shared so in case you caqn find something or know the source :)

- Rancy
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
GJohn32Author Commented:
Okay, changed the formula  to

Import-Csv "C:\xxx\xxx.csv" | ForEach{Set-DistributionGroup -Identity "xxx" -AcceptMessagesOnlyFrom $_.AuthorizedSender}

It appears to go thru in the shell. Once I hit enter it returns back to the C:\ prompt.  But no names appear in the EMC.
0
 
GJohn32Author Commented:
I changed the Excel header from "name" to "authorizedsender" and now it imports the last name on the list intsead of all the names.
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
So it was trying to find the details or information with "AuthorizedSender" as you had mentioned ..... Good to know that.

- Rancy
0
 
GJohn32Author Commented:
Well, it is seeing the list now, but only imports the last person on the list not all the names.
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
How do you have them aligned Something like User1, User2, User3 ?

- Rancy
0
 
GJohn32Author Commented:
I'm using their alias for the Test.

Excel spreadsheet has
A1:authorizedsender
A2: giedrojg
A3: stevense
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
authorizedsender under this tab try to Put giedrojg, stevense

- Rancy
0
 
GJohn32Author Commented:
Tried the following Alias in one cell.  Tried with and without a space.
A2: CaoA,Giedrojk,MartinezbJ


Will Not take this cmd.
Import-Csv "C:\xxx\xxx.csv" | ForEach{Set-DistributionGroup -Identity "xxx" -AcceptMessagesOnlyFrom $_.AuthorizedSender}

Error Couldn't find object "CaoA,Giedrojk,MartinezbJ". Please make sure that it was spelled correctly or specify a different object.

It will take this cmd
Set-DistributionGroup -identity "xxx" -AcceptMessagesOnlyFrom CaoA,Giedrojk,MartinezbJ

So I guess for now I will leave the import alone and just use the basic script.
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
CaoA, Giedrojk, MartinezbJ

- Rancy
0

Featured Post

Restore individual SQL databases with ease

Veeam Explorer for Microsoft SQL Server delivers an easy-to-use, wizard-driven interface for restoring your databases from a backup. No expert SQL background required. Web interface provides a complete view of all available SQL databases to simplify the recovery of lost database

  • 6
  • 6
Tackle projects and never again get stuck behind a technical roadblock.
Join Now