Avatar of Network Zero
Network ZeroFlag for United States of America

asked on 

Powershell \ Office 365 script

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

}

Open in new window

Powershell* monitorMicrosoft 365* Automation

Avatar of undefined
Last Comment
Network Zero
ASKER CERTIFIED SOLUTION
Avatar of Jian An Lim
Jian An Lim
Flag of Australia image

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Network Zero
Network Zero
Flag of United States of America image

ASKER

I'll see if I can test it tomorrow, thanks - It took forever for anyone to answer but thanks!
Avatar of Network Zero
Network Zero
Flag of United States of America image

ASKER

I don't have time to test at the moment.
Powershell
Powershell

Windows PowerShell is a task automation and configuration management framework from Microsoft, consisting of a command-line shell and associated scripting language built on the .NET Framework. PowerShell provides full access to the Component Object Model (COM) and Windows Management Instrumentation (WMI), enabling administrators to perform administrative tasks on both local and remote Windows systems as well as WS-Management and Common Information Model (CIM) enabling management of remote Linux systems and network devices.

27K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo