Exploring AI’s New Capabilities by Troubleshooting Microsoft 365

A while ago I wrote an article titled

The impact of AI on the MSP business model

In there I spoke I spoke about how AI would be more and more integrated with the services used today like Microsoft 365, especially when it comes to the administration.

I think a perfect illustration of what we can expected to see in the not to distant future is what I created this video about.

https://www.youtube.com/watch?v=Q3Y-8AzE2bw

In it I used Google AI Studio to troubleshoot an email issue in Microsoft 365. I was able to use the AI to converse with me and see what was displayed on screen and then stpe me through various steps to resolve my issues. Very impressive I must admit.

Imagine a world where this type of AI agent is built into every Microsoft 365 tenant or desktop, able to assist the user 24/7 with any issues or any errors that occur.

AI is changing everything.

Script to report tenant licenses

image

I have created a script that uses the Microsoft Graph to report iicenses for the tenant as shown above. You’ll find it here:

https://github.com/directorcia/Office365/blob/master/graph-licenses-get.ps1

along with the documentation here:

https://github.com/directorcia/Office365/wiki/Report-tenant-licenses

You will need to have the Microsoft Graph PowerShell module installed and up to date.

The first time you run the script you maybe prompted to login to your tenant and then you may also be asked to provide permissions. This script requires:

LicenseAssignment.Read.All

which you may need to consent to the first time.

After the script executs you should see an output as shown above showing the license, the total of licenses available in the tenant and those that are currently assigned.

You can also use the –csv command line option to put the results to a CSV file in the parent directory

Validate email address format with PowerShell

Here’s a handy function you can use in your PowerShell scripts when you need to verify that information contains a valid emails address.

function ValidateEmailAddress {
param (
[string]$EmailAddress
)

    $emailRegex = ‘^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$’
$isValid = $EmailAddress -match $emailRegex

    return $isValid
}

Just call the function and specify the text you want to verify as a parameter like:

ValidateEmailAddress(“director@ciaops.com”)

and you’ll get either True or False.

Connect to PnP PowerShell script

The latest pnp.powershell module (V2.X and above) now won’t work with PowerShell v5. Thus, I have updated my PnP connection script:

https://github.com/directorcia/Office365/blob/master/o365-connect-pnp.ps1

to accommodate this.

Thus, if you attempt to run this script in PowerShell version 5 with the latest pnp.powershell module you will typically see:

image

and the error is:

Could not load file or assembly ‘System.Management.Automation, Version=7.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35’ or one of its dependencies. The system cannot find the file specified.

However, when you run the script in PowerShell V7 you’ll see:

image

that the connection is successful.

I have also taken the opportunity to remove the dependency in the script as well on the now depreciated module MSONLINE and replaced it the Microsoft.Graph module.

This kind of signals the beginning of the end for modern cloud modules in PowerShell 5. However, some still require PowerShell 5 but I expect that to change.

In summary, the latest pnp.powershell modules require PowerShell version 7 and I have updated my connection script to accommodate this.

Announcing the CIAOPS Power Automate online course

image

I have just released my new Introduction to Power Automate course which you can find here:

https://www.ciaopsacademy.com/p/introduction-to-power-automate

The course is designed to give you a kick start into the world of automation with Microsoft 365. You’ll learn what Power Automate and Flows are including how to create the different types as well as use connectors to work with data from a variety of sources.

Inside you’ll find a variety of resources including video tutorials, web references, quizzes, examples and more. Upon completion, you will have the confidence to start automating many processes in your business.

Once you get started with Power Automate you’ll be amazed at how much time you’ll save, all using the tools that come with Microsoft 365.

Start here. Start today. And get more time in your day.

Power Automate Email Arrive action file size only 4 bytes

image

If you create a Power Automate with a trigger of When a new email arrives (V3) and you want to work with attachments in your Flow, ensure you select the Show advanced options as shown above.

image

If you don’t you’ll end up with saved attachments of only 4 bytes in size as shown above as by default the action doesn’t include attachments.

image

To work with attachments in your Flow, ensure the Include Attachments option is set to Yes as shown above. Then you’ll be able to do things like save the whole attachment to OneDrive for Business.



Get Teams Meeting Attendees via PowerShell and the Microsoft Graph

Here’s a handy way to get a list of attendees in Microsoft Teams using PowerShell. I have uploaded the script to do this here:

https://github.com/directorcia/Office365/blob/master/tms-attend-get.ps1

Before you run the script you’ll need to have the Graph PowerShell module installed.

image

You’ll also need to set some variable values for your own environment in the script. You can do this by locating $tenantid in the script as shown above, and setting that to your own tenant URL. Then find $meetingjoinurl and set that to the URL for that meeting. Finally, set $useremail to the email address of the user who created the meeting.

image

The meeting URL is the link people selected to join the meeting as shown above. You’ll also find it in the configuration for the meeting.

image

With all those settings updated, when you run the script it should look something like shown above. The script will connect to the Microsoft Graph with the scopes required to read the meeting details. You may be requested to login to the tenant and then potentially consent to these scopes during the connection phase. The required scopes are:

OnlineMeetingArtifact.Read.All
OnlineMeetings.Read

The script will get the GUID of the creator of the meeting from the email you specified followed by the meeting id from the meeting join link you specified, then the report id for that meeting and finally the report details for the meeting. It will then display the email address (if recorded) of attendees as shown above.

Of course, you can just download the CSV meeting report from the Teams page I know, but this process will be first step in eventually using Power Automate to get meeting attendees and send them an automatic follow up after the meeting. Stay tuned for details on that coming soon. This is simply proof of concept and a handy option if you do indeed just want to use PowerShell to get a list of meeting attendees.