troubleshooting Question

Powershell \ Office 365 script

Avatar of Network Zero
Network ZeroFlag for United States of America asked on
Microsoft 365Powershell* Automation* monitor
3 Comments1 Solution215 ViewsLast Modified:
I need a script to be able to monitor when a certain parameter changed on office 365.

"DeviceAccessState             : Blocked"

Basically I want to know if a users iPhone's been blocked. I want to keep this running and receive an email if it was blocked.

The two parameters are allowed and blocked.

Here's my current function that I use to connect to office 365 - works flawlessly:

Function connectO365 
{

    $URL = "https://ps.outlook.com/powershell"
    
    $Credentials = Get-Credential -Message "Enter your Office 365 admin credentials"

    $EXOSession = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $URL -Credential $Credentials -Authentication Basic -AllowRedirection -Name "Exchange Online"

    Import-PSSession $EXOSession

    Import-Module MSOnline

    Connect-MsolService –Credential $Credentials

}
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 3 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros