Get Distribution Groups Out of Your Network

%3CLINGO-SUB%20id%3D%22lingo-sub-13202%22%20slang%3D%22en-US%22%3EGet%20Distribution%20Groups%20Out%20of%20Your%20Network%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-13202%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%3EOne%20feature%20of%20Yammer%20is%20that%20users%20may%20allow%20Yammer%20to%20send%20invitations%20to%20join%20Yammer%20to%20accounts%20in%20that%20user's%20address%20book.%26nbsp%3B%20Which%20is%20pretty%20nice%20in%20general%2C%20but%20one%20of%20the%20unwanted%20side%20effects%20is%20that%20groups%20in%20your%20corporate%20network%20which%20have%20email%20addresses%20are%20sent%20invitations.%26nbsp%3B%20(For%20example%20All_Europe_Users%40contoso.com).%26nbsp%3B%20Additionally%2C%20invited%20and%20non-confirmed%20accounts%20are%20in%20pending%20status%2C%20and%20therefore%20show%20up%20as%20suggested%20accounts.%3CBR%20%2F%3E%3CBR%20%2F%3EWe%20have%20enough%20work%20to%20do%20helping%20people%20collaborate%20more%20effectively%3B%20we%20don't%20need%20all%20this%20traffic%20to%20accounts%20that%20aren't%20even%20really%20individuals.%26nbsp%3B%20To%20help%20make%20things%20clean%2C%20we%20need%20to%20get%20those%20group%20accounts%20out%20of%20there!%3CBR%20%2F%3E%3CBR%20%2F%3EWhat%20you%20need%20to%20do%20is%20get%20a%20list%20of%20group%20accounts%20which%20have%20email%2C%20and%20then%20suspend%20or%20delete%20each%20one.%26nbsp%3B%20When%20you're%20done%20that%2C%20you%20need%20to%20then%20block%20each%20one%20as%20well%2C%20or%20else%20someone%20will%20just%20re-invite%20the%20group%20account.%26nbsp%3B%20(Note%20that%20you%20will%20only%20be%20able%20to%20do%20that%20in%20paid%20networks%2C%20and%20you%20need%20to%20be%20a%20verified%20administrator).%3CBR%20%2F%3E%3CBR%20%2F%3ETo%20suspend%20or%20delete%2C%20go%20to%20%3C%2FSPAN%3E%3CSPAN%3E%3CFONT%20color%3D%22%23000000%22%3E%3CA%20href%3D%22http%3A%2F%2Fwww.yammer.com%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ewww.yammer.com%2F%3C%2FA%3E%26lt%3B%3C%2FFONT%3E%3CSPAN%3EYourHomeNetwork%26gt%3B%2Fadmin%2Fusers_bulk_update%20and%20read%20up%20how%20to%20do%20it.%26nbsp%3BCreate%20and%20o%3C%2FSPAN%3E%3CSPAN%3Epen%20the%20CSV%20file%20in%20Excel.%20Keep%20it%20as%20a%20CSV%20file%2C%20don't%20save%20it%20as%20XLSX.%26nbsp%3B%20There%20are%20great%20instructions%20on%20that%20Yammer%20page%20in%20your%20admin%20panel%20and%20you%20need%20to%20understand%20fully%20what%20you're%20doing%20before%20trying%20that%20out.%26nbsp%3B%20This%20and%20Block%20Users%20functionality%20are%20documented%26nbsp%3Bin%20the%26nbsp%3B%3C%2FSPAN%3E%3CA%20href%3D%22https%3A%2F%2Fsupport.office.com%2Fen-us%2Farticle%2FManaging-your-Yammer-users-Yammer-admin-guide-0fc72b66-cbf1-4202-bcf0-f2174ea96798%3Fui%3Den-US%26amp%3Brs%3Den-US%26amp%3Bad%3DUS%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%20noopener%20noreferrer%22%3E%3CSPAN%3EYammer%20Admin%20Guide%3C%2FSPAN%3E%3C%2FA%3E%3CSPAN%3E%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EAnyway%2C%20the%20hard%20part%20is%20getting%20that%20list%20of%20email%20addresses.%26nbsp%3B%20If%20you're%20lucky%20enough%20to%20have%20security%20admins%20to%20get%20that%20for%20you%2C%20get%20the%20list%20from%20them.%26nbsp%3B%20But%20if%20you're%20not%2C%20you%20can%20almost%20always%20get%20the%20list%20yourself%2C%20with%20just%20your%20regular%20old%20permissions.%3CBR%20%2F%3E%3CBR%20%2F%3EAssuming%20it's%20a%20Microsoft%20Active%20Directory%20(AD)%20network%2C%20which%20is%20true%20for%20almost%20everyone%2C%20you%20need%20to%20query%20AD.%26nbsp%3B%20Best%20to%20use%20PowerShell%20to%20do%20that.%26nbsp%3B%20%3CSTRONG%3E(Don't%20stop%20reading%20thinking%20you're%20not%20technical%20enough.%26nbsp%3B%20Yes%20you%20are%3B%20this%20is%20simple)%3C%2FSTRONG%3E.%3CBR%20%2F%3E%3CBR%20%2F%3ETo%20start%20PowerShell%20in%20Windows%208%2C%20just%20go%20to%20your%20tile%20screen%20and%20type%20PowerShell%20and%20it%20should%20come%20up%20as%20Windows%20PowerShell.%26nbsp%3B%20If%20you're%20on%20a%20previous%20version%20of%20Windows%2C%20Start%20-%20Run%20-%20PowerShell%2C%20or%20type%20PowerShell%20from%20a%20command%20prompt.%3CBR%20%2F%3E%3CBR%20%2F%3E%26nbsp%3BAt%20the%20prompt%2C%20enter%20this%20(copy%20and%20paste)%20then%20hit%20Enter%3A%3CBR%20%2F%3E%3CBR%20%2F%3E%26nbsp%3BGet-ADObject%20-LDAPFilter%20%22(%26amp%3B(objectclass%3Dgroup)(mail%3D*))%22%20-Properties%20Mail%20%7C%20Out-GridView%3CBR%20%2F%3E%3CBR%20%2F%3E(Note%3A%26nbsp%3B%20Easy%20way%20to%20paste%20in%20PowerShell%20is%20with%20the%20right%20mouse%20button.)%3CBR%20%2F%3E%3CBR%20%2F%3EWhat%20that%20does%20is%20it%20goes%20through%20Active%20Directory%20and%20gets%20all%20the%20groups%20you're%20allowed%20to%20look%20at%20(which%20should%20be%20all%20of%20them).%26nbsp%3B%20It%20searches%20for%20groups%20that%20have%20an%20email%20account%20associated%20with%20them%20(which%20aren't%20all%20of%20the%20groups%20-%20this%20helps%20you%20target%20only%20the%20ones%20that%20matter%20to%20you%20as%20a%20Yammer%20admin).%26nbsp%3B%20Then%20it%20displays%20them%20in%20a%20nifty%20looking%20grid.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20gave%20you%20that%20first%20because%20it%20shows%20you%20what%20you're%20dealing%20with%20for%20your%20network.%26nbsp%3B%20But%20you'll%20soon%20find%20that%20it's%20not%20helpful%20for%20you%20to%20actually%20do%20something%20about%20it.%26nbsp%3B%20This%20is%20really%20just%20a%20very%20simple%20way%20to%20get%20a%20view%20into%20the%20data%20in%20Active%20Directory.%26nbsp%3B%20My%20hope%20is%20that%20it%20makes%20what%20you're%20looking%20at%20more%20understandable%20and%20less%20scary%20for%20the%20less-technical%20folks.%26nbsp%3B%20It's%20just%20data.%26nbsp%3B%20%3A)%3C%2Fimg%3E%3CBR%20%2F%3E%3CBR%20%2F%3EFor%20the%20money%20script%20that%20will%20actually%20help%20you%20get%20where%20you're%20going%2C%20you'll%20need%20to%20figure%20out%20where%20you%20want%20a%20text%20file%20to%20be%20created.%26nbsp%3B%20This%20script%20uses%20C%3A%5CData%5CGroupMail.txt.%26nbsp%3B%20You%20need%20to%20choose%20your%20own%20path%2C%20something%20where%20you%20can%20access%20the%20text%20file%20when%20you're%20done.%3CBR%20%2F%3E%3CBR%20%2F%3EClose%20the%20grid%20from%20the%20last%20command.%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EAt%20the%20PowerShell%20prompt%2C%20enter%20this%20then%20hit%20Enter%3A%3CBR%20%2F%3E%3CBR%20%2F%3EGet-ADObject%20-LDAPFilter%20%22(%26amp%3B(objectclass%3Dgroup)(mail%3D*))%22%20-Properties%20Mail%20%7C%20Format-List%20-Property%20Mail%20%7C%20Out-File%20C%3A%5CData%5CGroupMail.txt%3CBR%20%2F%3E%3CBR%20%2F%3E(Copy%20and%20paste%2C%20but%20when%20you%20run%20it%2C%20you'll%20have%20a%20different%20place%20for%20your%20file%2C%20so%20delete%20%22C%3A%5CData%5CGroupMail.txt%22%20and%20enter%20the%20location%20and%20name%20of%20your%20file%20at%20the%20very%20end.)%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20go%20to%20where%20you%20saved%20that%20file%20and%20just%20double-click%20it.%26nbsp%3B%20You%20might%20not%20see%20the%20%22.txt%22%20part%20of%20the%20name.%26nbsp%3B%20Notepad%20should%20open%20up%20and%20you'll%20see%20a%20list%20of%20email%20addresses%2C%20double-spaced%2C%20with%20%22Mail%20%3A%20%22%20before%20each%20item.%26nbsp%3B%20You%20want%20to%20get%20rid%20of%20that%20prefix%2C%20since%20it's%20not%20helpful.%26nbsp%3B%20So%20Edit%20--%26gt%3B%20Replace%20--%26gt%3B%20Find%20what%3A%20%22Mail%20%3A%20%22%20(no%20quotes)%2C%20Replace%20with%3A%20(nothing).%26nbsp%3B%20Hit%20Replace%20All.%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20you%20have%20your%20email%20addresses%20double-spaced.%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3EGet%20rid%20of%20the%20extra%20space%20between%20each%20item%20by%20either%20copy%20and%20pasting%20that%20list%20into%20Excel%20or%20saving%20the%20text%20file%20and%20opening%20it%20with%20Excel.%26nbsp%3B%20Once%20you%20have%20the%20data%20in%20Excel%2C%20choose%20Data%20--%26gt%3B%20Sort%26nbsp%3B%20--%26gt%3B%20Column%20A%20--%26gt%3B%20A%20to%20Z%20--%26gt%3B%20OK.%3CBR%20%2F%3E%3CBR%20%2F%3ENow%20you%20should%20have%20something%20truly%20useful.%26nbsp%3B%20You%20can%20copy%20and%20paste%20all%20your%20values%20into%20a%20CSV%20file%20with%20a%20delete%20(or%20suspend)%20in%20front%20of%20it%20and%20upload%20it%20as%20a%20bulk%20update.%26nbsp%3B%20Poof%2C%20now%20all%20those%20accounts%20are%20gone%20from%20your%20network.%26nbsp%3B%20Now%20finish%20it%20up%20and%20make%20sure%20nobody%20invites%20any%20of%20those%20accounts%20back%20into%20your%20network.%26nbsp%3B%20Select%20them%20all%20as%20a%20list%20and%20copy%20and%20paste%20into%20your%20blocked%20list.%26nbsp%3B%26nbsp%3B%3CBR%20%2F%3E%3CBR%20%2F%3ECongratulations%2C%20all%20the%20groups%20in%20your%20network%20which%20have%20email%20addresses%20have%20been%20exiled%20from%20your%20Yammer%20network%2C%20never%20to%20return.%26nbsp%3B%20Pat%20the%20plush%20Yammy%20doll%20on%20your%20desk%20and%20celebrate.%26nbsp%3B%20Of%20course%2C%20new%20group%20accounts%20are%20created%20from%20time%20to%20time%20so%20this%20is%20something%20you%20should%20decide%20to%20schedule%20periodically.%3CBR%20%2F%3E%3CBR%20%2F%3EI%20hope%20that%20helps.%26nbsp%3B%20If%20you%20don't%20have%20access%20to%20PowerShell%2C%20there%20are%20ancient%20commands%20which%20do%20the%20same%20thing%20(dsget%2C%20dsquery)%2C%20but%20PowerShell%20is%20the%20way%20you%20want%20to%20go.%26nbsp%3B%20It's%20worth%20getting%20permission%20from%20your%20local%20administrator.%26nbsp%3B%20But%20if%20you're%20really%20stuck%20let%20me%20know%20and%20I'll%20list%20off%20how%20to%20do%20it%20the%20old%20way.%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%3E%3CSPAN%3E(Originally%20posted%20on%20the%20Office%20365%20Network%2019%20March%2C%202015.)%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Regular Contributor

One feature of Yammer is that users may allow Yammer to send invitations to join Yammer to accounts in that user's address book.  Which is pretty nice in general, but one of the unwanted side effects is that groups in your corporate network which have email addresses are sent invitations.  (For example All_Europe_Users@contoso.com).  Additionally, invited and non-confirmed accounts are in pending status, and therefore show up as suggested accounts.

We have enough work to do helping people collaborate more effectively; we don't need all this traffic to accounts that aren't even really individuals.  To help make things clean, we need to get those group accounts out of there!

What you need to do is get a list of group accounts which have email, and then suspend or delete each one.  When you're done that, you need to then block each one as well, or else someone will just re-invite the group account.  (Note that you will only be able to do that in paid networks, and you need to be a verified administrator).

To suspend or delete, go to
www.yammer.com/<YourHomeNetwork>/admin/users_bulk_update and read up how to do it. Create and open the CSV file in Excel. Keep it as a CSV file, don't save it as XLSX.  There are great instructions on that Yammer page in your admin panel and you need to understand fully what you're doing before trying that out.  This and Block Users functionality are documented in the Yammer Admin Guide 

Anyway, the hard part is getting that list of email addresses.  If you're lucky enough to have security admins to get that for you, get the list from them.  But if you're not, you can almost always get the list yourself, with just your regular old permissions.

Assuming it's a Microsoft Active Directory (AD) network, which is true for almost everyone, you need to query AD.  Best to use PowerShell to do that.  (Don't stop reading thinking you're not technical enough.  Yes you are; this is simple).

To start PowerShell in Windows 8, just go to your tile screen and type PowerShell and it should come up as Windows PowerShell.  If you're on a previous version of Windows, Start - Run - PowerShell, or type PowerShell from a command prompt.

 At the prompt, enter this (copy and paste) then hit Enter:

 Get-ADObject -LDAPFilter "(&(objectclass=group)(mail=*))" -Properties Mail | Out-GridView

(Note:  Easy way to paste in PowerShell is with the right mouse button.)

What that does is it goes through Active Directory and gets all the groups you're allowed to look at (which should be all of them).  It searches for groups that have an email account associated with them (which aren't all of the groups - this helps you target only the ones that matter to you as a Yammer admin).  Then it displays them in a nifty looking grid.

I gave you that first because it shows you what you're dealing with for your network.  But you'll soon find that it's not helpful for you to actually do something about it.  This is really just a very simple way to get a view into the data in Active Directory.  My hope is that it makes what you're looking at more understandable and less scary for the less-technical folks.  It's just data.  :)

For the money script that will actually help you get where you're going, you'll need to figure out where you want a text file to be created.  This script uses C:\Data\GroupMail.txt.  You need to choose your own path, something where you can access the text file when you're done.

Close the grid from the last command.  

At the PowerShell prompt, enter this then hit Enter:

Get-ADObject -LDAPFilter "(&(objectclass=group)(mail=*))" -Properties Mail | Format-List -Property Mail | Out-File C:\Data\GroupMail.txt

(Copy and paste, but when you run it, you'll have a different place for your file, so delete "C:\Data\GroupMail.txt" and enter the location and name of your file at the very end.)

Now go to where you saved that file and just double-click it.  You might not see the ".txt" part of the name.  Notepad should open up and you'll see a list of email addresses, double-spaced, with "Mail : " before each item.  You want to get rid of that prefix, since it's not helpful.  So Edit --> Replace --> Find what: "Mail : " (no quotes), Replace with: (nothing).  Hit Replace All.

Now you have your email addresses double-spaced.  

Get rid of the extra space between each item by either copy and pasting that list into Excel or saving the text file and opening it with Excel.  Once you have the data in Excel, choose Data --> Sort  --> Column A --> A to Z --> OK.

Now you should have something truly useful.  You can copy and paste all your values into a CSV file with a delete (or suspend) in front of it and upload it as a bulk update.  Poof, now all those accounts are gone from your network.  Now finish it up and make sure nobody invites any of those accounts back into your network.  Select them all as a list and copy and paste into your blocked list.  

Congratulations, all the groups in your network which have email addresses have been exiled from your Yammer network, never to return.  Pat the plush Yammy doll on your desk and celebrate.  Of course, new group accounts are created from time to time so this is something you should decide to schedule periodically.

I hope that helps.  If you don't have access to PowerShell, there are ancient commands which do the same thing (dsget, dsquery), but PowerShell is the way you want to go.  It's worth getting permission from your local administrator.  But if you're really stuck let me know and I'll list off how to do it the old way.

 

(Originally posted on the Office 365 Network 19 March, 2015.)

 

0 Replies