Exchange 2010--Powershell Question

In setting up the following PS Script:

$List = import-csv D:\user.csv
Get-mailbox $List.Name

I get an output of mailbox information of my entire Exchange organization when I simply want the information of these few users.

My csv is:
Name
joe.smith@domain.com
Sue.smith@domain.com
Jane.doe@domain.com

What might be the issue?
Anthony K O365Asked:
Who is Participating?
 
SubsunConnect With a Mentor Commented:
Try this
$list=import-csv D:\User.csv
Foreach ($i in $list) {
 $Grp= get-distributiongroup My_DG
	$manage = $Grp.managedby
	$Newuser = Get-User $i.name
	$Newmanage = $manage+$Newuser
 Set-distributiongroup $Grp.identity -managedby $Newmanage -bypasssecuritygroupmanagercheck 
}

Open in new window

0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
What do you want exactly ?

- Tancy
0
 
Anthony K O365Author Commented:
I want to import a csv file and add these users to the ManagedBy permission in this DG, using following PS:

$list=import-csv D:\User.csv
Foreach ($i in $list) {
 $newuser=get-mailbox $i.name
 Set-distributiongroup My_DG -managedby $newuser -bypasssecuritygroupmanagercheck }
 

any thougths?
0
SMB Security Just Got a Layer Stronger

WatchGuard acquires Percipient Networks to extend protection to the DNS layer, further increasing the value of Total Security Suite.  Learn more about what this means for you and how you can improve your security with WatchGuard today!

 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
Get-Content D:\User.csv |  Set-distributiongroup My_DG -managedby "UserName" -bypasssecuritygroupmanagercheck

- Rancy
0
 
Anthony K O365Author Commented:
Here is the error I get when


PS] D:\>./manageby.ps1
Cannot process argument transformation on parameter 'Identity'. Cannot convert value "" to type "Microsoft.Exchange.Configuration.Tasks.UserIdParameter". Error: "Parameter values of type Microsoft.Exchange.Configuration.Tasks.UserIdParameter can't be empty. Specify a value, and try again.
Parameter name: identity"
    + CategoryInfo          : InvalidData: (:) [Get-User], ParameterBindin...mationException
    + FullyQualifiedErrorId : ParameterArgumentTransformationError,Get-User

All groups must have at least one owner who manages membership, message approval, and other settings for the group. Make sure you assign an owner for this group.
    + CategoryInfo          : NotSpecified: (:) [], RecipientTaskException
    + FullyQualifiedErrorId : A34ABEE7
0
 
Manpreet SIngh KhatraSolutions Architect, Project LeadCommented:
What is the command you ran did you provide the username and remove quotes ?

- Rancy
0
 
Anthony K O365Author Commented:
Your last suggestion worked!  However, it still produced the error message "cannot convert the value "" to type...

My csv did not have any quotes. Go figure...

Thanks!
0
 
SubsunCommented:
You have lot of trouble with CSV files.. :-).. I didn't see any issue with script.. Can you post the csv file which you used? probably it has some blank lines..
0
All Courses

From novice to tech pro — start learning today.