powershell

I have Active Directory with the schema extended for Exchange 2013.  I am looking to run a powershell 3.0 script (from my Windows 7 x64 laptop) that will provide me with a report/list of all configured ManagedBy (schema attribute) distribution groups within my Active Directory.  I can view the ManagedBy attribute as a property of the Distribution Group, but I do not have the get-distributiongroup cmdlet on my powershell.  Ideally I'd like to run something similar to below...

"Get-DistributionGroup * | Format-Table Name, ManagedBy"

Do you know of a module I can import to get that cmdlet?  I have the below two PS lines but they need to be joined and search entire directory (if that makes sense).


#This will get me a list of all global distribution groups, displaying only the group name sorting by the name.
"Get-ADGroup -Filter {GroupCategory -eq "Distribution" -and GroupScope -eq "Global"} | Sort-Object | Format-Table Name"

#This will display a specific group and the managedby property.
"Get-ADGroup -Identity <groupname> -Properties ManagedBy"

Thoughts?
jmachado81Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Brad GrouxSenior Manager (Wintel Engineering)Commented:
I believe for security reasons Exchange related PowerShell Cmdlets must be run from the Exchange Management Shell.

http://technet.microsoft.com/en-us/library/dd638134(v=exchg.150).aspx

Exchange Management Tools which were utilized in previous versions of Exchange have been replaced by the Exchange Admin Center in Exchange 2013. EAC is now web based and can be accessed via IE at https://<CASServerName>/ecp  internally or https://mail.contoso.com/ecp externally.

http://technet.microsoft.com/en-us/library/jj150562%28v=exchg.150%29.aspx
0
jmachado81Author Commented:
Our Exchange environment is hosted in Office365, but that is synced to our AD.  Since Office365 pulls from our AD we should "theoretically" be able to run a script against our internal AD to get that information.

With that additional information, would we have to do a "connect-msolservice" then?  Again I can see all these settings when I open ADUC.
0
Adam FarageEnterprise ArchCommented:
To connect to Office 365 for Exchange using PowerShell, you would need to import a new session into the powershell module: http://technet.microsoft.com/en-us/library/jj984289%28v=exchg.150%29.aspx

You *could* use the Exchange 2013 Exchange Management Shell for this, but you would still have to import a new session. I usually manage my clients O365 from my desktop, since Windows 8.1 comes with PowerShell.

I think that is where your issue is.

The same thing goes if you are doing DirSync to Azure AD: http://technet.microsoft.com/en-us/library/jj151815.aspx
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

footechCommented:
Get-ADGroup -Filter {GroupCategory -eq "Distribution" -and GroupScope -eq "Global"}  -Properties ManagedBy | Sort-Object Name | Format-Table Name, ManagedBy

Open in new window

This combines the two and displays the Name and ManagedBy info.  Since this information is available in your AD, you don't have to connect to Office365 to get it.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
jmachado81Author Commented:
That is great footech.  A colleague was able to manipulate that to this, so it doesn't display ones with a null value.

Get-ADGroup -Filter {GroupCategory -eq "Distribution" -and GroupScope -eq "Global"} -property * | where-object {$_.managedby.length -gt 0}| select name,managedby |Sort-Object -Property name
0
footechCommented:
If you're concerned at all about the speed with which that runs, change -property * to -property ManagedBy for the Get-ADGroup command.  If you don't have that large a number of groups you may not see a noticeable difference however.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.