Whether you want to do some reports or debugging, you might need to quickly find out what Distribution Groups a user is a member of! You could go in the user’s profile, see all of the groups , find out which ones are Security, which ones are Distribution Groups.. or you could do an easy PowerShell cmdlet!

Find all the Distribution Groups a user is a member of with PowerShell

Since we will be playing with Exchange Online, you first need to connect to Exchange!

 

Next up, I will save the Username of the person I am looking for in a variable called Username

And then, I will use this cmdlet which will get all the Distribution Groups in my tenant, and then find the ones where my username is in the members! (This assumes your e-mail address is the same as the username! If that’s not the case, you can simply put the e-mail in the UserName variable and it will work!)

You can now either Display it , or do another action such as removing the user from all of them!

Find all the Distribution Groups a user is a member of with PowerShell in Office 365

That’s it! As you see this is really an quick and easy PowerShell snippet!

 

Leave a comment and don’t forget to like the Absolute SharePoint Blog Page   on Facebook and to follow me on Twitter here  for the latest news and technical articles on SharePoint.  I am also a Pluralsight author, and you can view all the courses I created on my author page.
4.57/5 (7)

Please rate this

You cannot have full control of your Office 365 tenant, if you do not know how to use PowerShell for Office 365, since there are a ton of configurations, and settings that are only configurable via PowerShell, and not via the Office 365 Admin Center! Not to mention, all the automation capabilities that PowerShell allows you to script, so you save time and money. Since most accounts admin accounts are (or should be) configured with Multi Factor Authentication, here is a small guide on how to connect to all the Office 365 services with PowerShell and Multi Factor Authentication enabled!

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Azure Active Directory

Once you have the Azure Active Directory module installed, connecting with Multi Factor Authentication is done by specifying the AccountId parameter, and not a full credential object as we would do with single factor authentication. This will Open up a window, asking you to enter the password for that account, and then your second authentication method as seen below.

 

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

SharePoint Online

When we connect to SharePoint Online using PowerShell, we use the Connect-SPOService cmdlet as usual as well as the URL parameter, which is the URL of your SharePoint Online Admin Center, and simply skip specifying the -Credentials parameter. This will open a pop-up window asking for our credentials, as well as the second method of Authentication as you can see below!

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Exchange Online

While the previous two were easy, this one is a bit more complicated since we need to download a module, whereas to connect with Single Factor Authentication there is nothing to download! From the Exchange Online Admin Center, go to the Hybrid section, and click on Configure under the Exchange Online PowerShell module.

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

You need to do this with Internet Explorer, or else you will be getting a beautiful “Application Cannot Be Started” error as we talked about in this blog! Exchange Online PowerShell Module Error: Application Cannot be Started – Contact the Application Vendor

Once you have the Exchange Online Module, you need to use the Connect-EXOPSSession PowerShell cmdlet, and specify the user account that you will be connecting with.

 

If you are in Office 365 Germany, you need to provide a few more parameters, as seen in the following example.

 

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Office 365 Security and Compliance Center

To connect to the Office 365 Security and Compliance Center with Multi Factor Authentication, you need the same PowerShell module as Exchange Online, about which we talked earlier, but you will be using the Connect-IPPSSession PowerShell cmdlet as seen in the following example.

If you are part of Office 365 Germany, you will need to provide the additional parameters seen below.

 

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Skype for Business

To connect to Skype for Business Online using Multi Factor Authentication , you need to use the New-CSOnlineSession PowerShell cmdlet

 

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Microsoft Teams

To Connect to Microsoft Teams, you use the Connect-MicrosoftTeams PowerShell cmdlet, and specify the -AccountID parameter. Similar to the other services, you will get a prompt asking you to input your password, and second method of authentication.

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

Connecting to all Office 365 Services with PowerShell and Multi Factor Authentication

That is it, we have now looked at how to connect to all Office 365 Services, using PowerShell and Multi Factor Authentication!

Leave a comment and don’t forget to like the Absolute SharePoint Blog Page   on Facebook and to follow me on Twitter here  for the latest news and technical articles on SharePoint.  I am also a Pluralsight author, and you can view all the courses I created on my author page.
5/5 (2)

Please rate this

This year I have the great pleasure again of travelling to DC to speak at SharePoint Fest DC 2018! This year’s SharePoint Fest is the biggest one ever with 2 days of workshops, and 3 days of sessions! Just look at the numbers below!

If you didn’t sign up yet, you can use my code to save 100$ of your registration on the site at https://sharepointfest.com/DC/

Here is what I will be speaking on!

Morning Workshop 9:00 am – 12:30 pm, Monday WS 201 – Congratulations, you are our new SharePoint Online Admin!

You have managed SharePoint On-Premises for a while and got comfortable with it, but now your company is moving to Office 365! Chances are, you will become the new SharePoint Online Admin!

In this half day workshop, we will look at how to administer SharePoint Online, as well as some other Office 365 services that are often administer by the SharePoint Online Admin such as Groups, Planner, Video and more!

Afternoon Workshop 1:30 pm – 5:00 pm, Tuesday WS 601 – Mastering PowerShell for Office 365

Until you master PowerShell, you cannot have full control of your Office 365 tenant! PowerShell enables you automate boring tasks, and also gives you access to the more advanced settings that are not available in the Office 365 admin center. In this workshop, we will learn how to manage our users and licenses in Azure Active Directory, manage our SharePoint Online Sites, Exchange Online, Office 365 Groups as well as Skype for Business!

After finishing this workshop, you will be able to manage all the aspects of your Office 365 tenant, and automate multiple boring tasks.

BV 301 -What do YOU get from SharePoint Hybrid?

Every time you see a blog post about SharePoint 2016, you see the word hybrid. But what exactly is a hybrid infrastructure and what features does the business user get? In this session, we will look at SharePoint Hybrid from a business user point of view to understand what features we get out of it. We will look at Hybrid Sites, Hybrid Search, Hybrid Taxonomy and more!

ADM 203 – Advanced PowerShell for Office 365

Know the basics of PowerShell for Office 365 but want to take it further? In this session, we will look at some awesome real-life examples of how PowerShell can make our life as an admin easier, and at quite a few things that cannot be done from the User Interface! This session requires you to have basic knowledge of PowerShell for Office 365.

WF 103 – Three Must-Have Workflows with Microsoft Flow

Are you on Office 365 or planning to move soon? Learn how to automate business processes with Microsoft’s latest workflow tool: Microsoft Flow! In this session, we will earn the basic of workflows, how Flow works and create a few awesome examples!

Hope to see you there!

5/5 (2)

Please rate this

While working on some reporting with PowerShell and Office 365, I have discovered something that might be important if you use the Get-SPOExternalUser PowerShell cmdlet to create reports on your SharePoint Online external users.

Get-SPOExternalUser PowerShell

At the end of 2017, Microsoft has released a new , simpler, and nicer way to share SharePoint Online content with your external partners, allowing them to log in with a simple pin / e-mail validation , without them needing to have a Microsoft account anymore. Users loved it, but it seems the PowerShell module hasn’t yet been updated to show those new users yet. Microsoft is already aware of this problem and they have an issue open on the GitHub site for the SharePoint Online PowerShell Module.

This is valid as of the February 2018 version of the SharePoint Online PowerShell Module and I will update this blog with the version when Microsoft fixes it or gives an official workaround . You can also check live updates directly on the issue on GitHub!

The Bug

To show you the bug, I will first invite an external user to a document in a modern SharePoint Online site called Modern Share Test, you can see the screenshot of the invite below.

Get-SPOExternalUser PowerShell

I will then navigate to outlook for this example, accept the invite and then log in to view the document shared with me. As you see in the screenshots below, I am first asked to validate by e-mail, Microsoft Sends me a PIN number, I enter it in the box, and it all works nicely. Off topic, but good job to the Microsoft people who worked on this feature as the end-user experience is amazing.

Get-SPOExternalUser PowerShell

Get-SPOExternalUser PowerShell

Now I will go to PowerShell and run a Get-SPOExternalUser on that Site Collection, and as you see below, it only returns a user, and it’s not the one we just invited!

Get-SPOExternalUser PowerShell

However, if I run an Get-SPOUser cmdlet against the same site, we can see that users added with this modern sharing option have a different login name vs our old external users. The Old naming convention was using #ext# while the new one is urn:spo:guest . In the screenshot below, you can see the accounts in a red box that use modern sharing, and the new naming convention, and the account in the green box that uses the older, Microsoft account method (or Azure B2B).

Get-SPOExternalUser PowerShell

Luckily, even if the Get-SPOExternalUser PowerShell cmdlet is not perfect anymore and only works with accounts that log in with a Microsoft account, we can still create reports using the existing cmdlets.

The Workaround

Here is a small script that I have done that uses the Get-SPOUser cmdlet to return the external users per site collection and exports them to a CSV file at the end and includes the URl so you can also do some nice filtering. There are a ton of ways to do PowerShell, and probably a ton of ways to do this, but here is a way that I have tested, and it works!

 

And here is a screenshot of the CSV, with a Filter on the URL we have talked about before!

Leave a comment and don’t forget to like the Absolute SharePoint Blog Page   on Facebook and to follow me on Twitter here  for the latest news and technical articles on SharePoint.  I am also a Pluralsight author, and you can view all the courses I created on my author page.

Follow me on Social Media and Share this article with your friends!

5/5 (5)

Please rate this

One of the really cool things that we can do with SharePoint Online is to easily share documents, or sites with external users. The cooler thing even is that now my users can securely share stuff, without having to go through IT, so as an Office 365 Admin, I have a lot more time to be productive, rather then create FBA or AD accounts for my external users as I did On-Premises. However, even if I don’t have to do it myself, I still want to stay informed about what external users have access to what, and who got added to what Site Collection, so I have created a few scripts for it!

My first report is one that I run on a weekly basis, and it’s a easy one: What users have been added to my SharePoint Online environment in the last 7 days? The script is simple, I will use the Get-SPOExternalUser cmdlet to get all of my external users, and I am using the loop that I have blogged about here (Getting More than 50 users with the Get-SPOExternalUser PowerShell cmdlet in SharePoint Online) in order to get more than the limit of 50 per query. I am adding a Where statement, where I specify that I only want users that have the WhenCreated property bigger than Today – 7 days, which means they have been created in the last 7 days! Lastly, I am selecting the properties that I want to show and format the result as a table.

 

Here is what this looks like in action:

Create a report of SharePoint Online External Users with PowerShell

My second report is something that you can either run on a scheduled basis, or only whenever security asks for a more formal report on what is happening in the tenant. What it does is that it will loop trough every Site Collection, and then output every external user that has access to that Site Collection. We will save information about the user in a custom object, as well as the URL of the site they had access to. Lastly, we will export everything to CSV, which as you know allows us to do some nice filtering directly in Excel, or if you want to take it to the next level you can even use it as a data source for a Power BI report let’s say, but we will not get into that topic today. Here is the script:

 

And here is the result in the CSV File opened in Excel! I could use filtering on the URL, or on the User license if I wanted to get more info!

Create a report of SharePoint Online External Users with PowerShell

The last report that I want to show you is a really interesting one that can be really important for your organization: It shows you all the external accounts that have been invited to your tenant using an e-mail address, but they have accepted the invitation and are using a different e-mail address to authenticate to your SharePoint Online. To put it in a more real-life example, let’s say you created a site to work with Contoso, and you invited vlad@contoso.com to your SharePoint Online Site Collection. When receiving the invitation, Vlad has decided to use his personal e-mail address: vlad@hotmail.com to authenticate to your Site Collection. If Vlad decides to leave Contoso, even if his corporate account is disabled, he can still have access to the Site Collection you shared with him since the account that has access is the personal one. If your NDA agreement for example was between Contoso / Your Company and he’s not at Contoso anymore, this can cause you troubles down the road! To get those accounts, you need to use the following parameter, which probably can win an award for one of the longest parameters in PowerShell: ShowOnlyUsersWithAcceptingAccountNotMatchInvitedAccount. Here is the full code:

And here is a screenshot of the result:

Create a report of SharePoint Online External Users with PowerShell

Leave a comment and don’t forget to like the Absolute SharePoint Blog Page   on Facebook and to follow me on Twitter here  for the latest news and technical articles on SharePoint.  I am also a Pluralsight author, and you can view all the courses I created on my author page.

Follow me on Social Media and Share this article with your friends!

5/5 (5)

Please rate this

One of the reports that a lot of Office 365 admins use, is to see what external users have access to the tenant in SharePoint Online. Luckily, Microsoft offers a PowerShell cmdlet in the SharePoint Online module named Get-SPOExternalUser.

More Than 50 External Users With the Get-SPOExternalUser

While that cmdlet might seem easy and straightforward to use, there is a small catch; it can only return 50 External Users at a time due to a limit on the PageSize Parameter.

More Than 50 External Users With the Get-SPOExternalUser

A lot of scripts that you find on the Internet will give you a command like Get-SPOExternalUser -Position 0 -PageSize 50 … and that will work great , if you have less than 50 users in your tenant! However, if you have more than 50, you will need to do something just a little bit more advanced in order to be able to see all of them. What we will do, is that we will use a For Loop wrapped in a try/catch and try to get 50 users at a time, playing with the -Position parameter until the cmdlet stops returning information. You can view the script below:

 

And here a screenshot example where I am checking the number of users returned, and as you can see it’s over 50, so the script worked!

Leave a comment and don’t forget to like the Absolute SharePoint Blog Page   on Facebook and to follow me on Twitter here  for the latest news and technical articles on SharePoint.  I am also a Pluralsight author, and you can view all the courses I created on my author page.

Follow me on Social Media and Share this article with your friends!

5/5 (3)

Please rate this

Creating a Secret Office 365 Group

Categories: Powershell
Comments: No

When presenting my PowerShell for Office 365 sessions I always show to create a Secret Office 365 Group for users to collaborate securely .. and privately. Why not a simple Office 365 Group of type Private? Let me show you!

Below, I have create an Office 365 Group via the User Interface called “Private Group” , and of type Private, with two members inside!

Secret Office 365 Group

Since this group was created via the User Interface and no additional settings were configured, a member called Vanessa below, can go into the Discovery tab, and find the Private Group I have created before, even if she is not a member!

Secret Office 365 Group

Even better (or worst), once Vanessa goes in to the group, she will not be able to see the e-mails, or any content, but she will be able to see the members of the group as you can see below!

Secret Office 365 Group

Secret Office 365 Group

This of course can be useful in some occasions for example, if you had Project Sites, it’s okay to see who the owner of a certain project is if you need to request to Join, or something like this! However, if this group was for a re-org, you probably don’t want all the company to be able to find out there is a re-org going on next year, even worst, you don’t want them to know that they are the only manager not in that group! Luckily, there is a way to create a Secret Office 365 Group (by the way: This is a term I came up with, there is no official, secret category😊).

The bad news, is that this can only be done via PowerShell, and not via the User Interface! You will first have to connect to Exchange Online by using PowerShell, and I will not cover how to do this in this blog post. (Check the links at the bottom of this blog to see a few resources).

The first thing we need to do is to create the new Office 365 group, specifying the Private Access Type, and a very important parameter which is -HiddenGroupMembership.

This first step doesn’t hide it, and as you can see below, Vanessa can still see the group in the Discovery Tab.

Secret Office 365 Group

However, when going inside the group, not only Vanessa can’t see any conversations, but the Members widget and group information from the top right is gone! So Vanessa knows there will be a re-org, but she cannot see who is a member/owner of the group, and cannot do a request to join!

Secret Office 365 Group

Now, to hide it from search, we need to modify that group using PowerShell , and setting the group to be hidden from the Address List:

After this is done, the group will not show up in the Groups Search anymore! (Make sure to close Outlook and re-open as it might cache results)

Secret Office 365 Group

That is it! Now, how do we apply this to existing Groups? Unfortunately, the Hidden Group Membership cannot be done on groups after they have been created, so if someone find the link to them, they will be able to see the membership. The good news is that you can use PowerShell quite easily to update all existing Private groups to be hidden from search!

Now, even the Private Group is Hidden from Search!

Secret Office 365 Group

That is it, once you know how to use PowerShell for Office 365, you can easily create Secret Office 365 Groups!

 

Leave a comment and don’t forget to like the Absolute SharePoint Blog Page   on Facebook and to follow me on Twitter here  for the latest news and technical articles on SharePoint.  I am also a Pluralsight author, and you can view all the courses I created on my author page.
No ratings yet.

Please rate this

I am excited to announce that my second book is now available for pre-order on Amazon and this one is called “Essential PowerShell for Office 365”. Here are some details about the book:

Take your Office 365 skills to the next level. Master PowerShell for Office 365 to stay competitive in today’s world of highly sought after cloud management skills. With expert guidance, IT pros will learn how to leverage the muscle of PowerShell to automate many advanced administrative tasks not otherwise accessible in the Office 365 Admin Center. You will discover how to unlock configuration options and automate tasks in order to free up valuable time and resources.

This book is your companion to administering Office 365 with PowerShell. You will learn time-saving techniques such as how to streamline administrative tasks, and how to manage users, licenses, and Office 365 services. Expert and MVP Vlad Catrinescu introduces each chapter with an overview and basic fundamentals, such as how to connect to your required service in Office 365, so that you have a solid foundation for success. Benefit from learning the theory behind PowerShell for Office 365 and put your knowledge to practice with numerous hands-on code examples.

Essential PowerShell for Office 365

What You’ll Learn

  • Manage users in bulk
  • Export data such as user lists and groups
  • Create and manage Office 365 groups
  • Manage Exchange online distribution lists, mailboxes, and contacts
  • Configure Skype for Business settings
  • Perform compliance searches directly from PowerShell

Who This Book Is For

Any IT pro who needs to manage Office 365 or one of its services such as Exchange, SharePoint, or Skype for Business. Readers should have a basic knowledge of PowerShell and the Office 365 service they want to manage.

How can I get it?
Get it on Amazon at the following links:

Or you can also find it at Apress over here: https://www.apress.com/us/book/9781484231289#aboutBook

I really hope that this book will come in useful for you, especially as more organizations are moving to the cloud, being able to manage your Office 365 tenant using both using the UI for basic stuff, and PowerShell for advanced stuff will be a key skill! Let me know if you bought the book, and please share this with your networks!

4.5/5 (2)

Please rate this

As you have probably seen it all over Social Media the past few months, the SharePoint Conference is coming back to Las Vegas in May 2018! This promises to be an amazing conference, with all sorts of announcements, deep dive technical sessions and of course great networking!

SharePoint Conference North America

There will be over 50 Speakers at the event, some of which you can probably recognize from the picture below, and even if the conference has SharePoint in its name, it will cover Office 365, Planner, Microsoft Teams, Microsoft Flow, Yammer, and almost all the products in Office 365 that interreact in a way or another with SharePoint!

SharePoint Conference North America

I will personally be doing two sessions, here are the titles:

PowerShell all the things

Know the basics of PowerShell for Office 365 but want to take it further? In this session, we will look at some awesome real-life examples of how PowerShell can make our life as an admin easier, and at quite a few things that cannot be done from the User Interface! This session requires you to have basic knowledge of PowerShell for Office 365.

Three Must-Have SharePoint Workflows with Microsoft Flow

Process automation is one of the most wanted benefits that SharePoint offers. In this session, we will use Microsoft Flow and look at three real-life examples of processes that you can automate by using Microsoft Flow!

I am also talking a bit about what I cover in both those sessions, in the video below!

 

 

If you register before February 26th, not only will you get the cheapest price available, but if you also register for a workshop you can get an awesome gift such as Xbox One S/X or a Harman Kardon Invoke!

SharePoint Conference North America

In addition, if you use the code VLAD when registering, you will save an extra 50$ , so make sure you register as soon as possible to get the cheapest price at https://sharepointna.com !

Social

Follow me on Social Media and Share this article with your friends!

#Snippet

Leave a comment and don’t forget to like the Absolute SharePoint Blog Page   on Facebook and to follow me on Twitter here  for the latest news and technical articles on SharePoint.  I am also a Pluralsight author, and you can view all the courses I created on my author page.
Leave a comment and don’t forget to like the Absolute SharePoint Blog Page   on Facebook and to follow me on Twitter here  for the latest news and technical articles on SharePoint.  I am also a Pluralsight author, and you can view all the courses I created on my author page.
5/5 (2)

Please rate this

In just a few weeks, I will have the pleasure of travelling to Branson, Missouri for the North American Collaboration Summit, previously known as SharePointalooza! The North American Collaboration Summit is a great, and affordable conference happening on March 2nd and 3rd with 50 speakers, including 31 MVPs, and 6 Regional Directors / Microsoft Employees!

North American Collaboration Summit

If you register at the following link: https://www.eventbrite.com/e/sharepointalooza-the-north-american-collaboration-summit-tickets-37160124934?discount=catrinescu which includes a special discount code, you can save an extra 50% on the two-day conference pass, meaning that a ticket to a 2-day conference, with 50 amazing speakers, is only 32.50$ ! That is, hands down the cheapest conference of 2018, and if your boss didn’t approve your past conferences due to budget reasons, there is no way this one will not be approved!

North American Collaboration Summit

If you want to learn more about the conference, you can view all the speakers, and schedule at the following link: http://collabsummit.org/ ! My company, Valo Intranet is also a platinum sponsor, so make sure to come see us and win great prizes! Are you joining me in Branson? Drop a line in the comments and I am looking forward to see you!

Follow me on Social Media and Share this article with your friends!

Leave a comment and don’t forget to like the Absolute SharePoint Blog Page   on Facebook and to follow me on Twitter here  for the latest news and technical articles on SharePoint.  I am also a Pluralsight author, and you can view all the courses I created on my author page.
5/5 (3)

Please rate this