Peter_W Posted March 12, 2015 Posted March 12, 2015 I made the script below when a student sent a mass email to everyone in the school . I tried using piping to make this a possible one-liner but there was whitespace added and the damn trim function wouldn't work. I couldn't find anything on the web that did this so I hope this will be useful for anyone else. add-pssnapin Microsoft.Exchange.Management.PowerShell.E2010 import-module ActiveDirectory $filepath = "C:\students.csv" Get-ADGroupMember "Students" | Export-CSV $filepath Import-CSV $filepath -Header dish,name,oc,uid,samaccname,sid | Foreach-Object{ Set-Mailbox -Identity $_.samaccname -RecipientLimits 2 }
ascott2 Posted March 17, 2015 Posted March 17, 2015 I wrote a similar one a few years back, you can do it as a one liner and without the need for the AD module, so long as it is a group that has been enabled in exchange. I think it was something like this, using the Exchange Get-Group cmdlet rather than the AD Group cmdlet. (get-group "GroupName").Members | Set-Mailbox -RecipientLimit 2
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now