Last week (Week of July 22, 2019) Microsoft released a new feature in Intune where admins now can send custom notifications to the Company Portal app to Android and iOS devices.



A short explenation of the function is that you send a notification to the Company portal application on iOS and Android devices. You need to specify a Title and Body which contains the message and then you choose which group in Azure to send it to.

Microsofts Official documentation can be found here: https://docs.microsoft.com/en-us/intune/custom-notifications

If you’re like me and don’t want to use the Intune Portal more than absoloutly necessary we also have the option to send notifications using the Intune powershell SDK.

The latest Intune Powershell SDK version 6.1907.1.0 which can be found here https://www.powershellgallery.com/packages/Microsoft.Graph.Intune/6.1907.1.0 If you want to know more about the Intune Powershell SDK check out my blog post below Intune Powershell SDK – 2019

Why can’t I find the cmdlet?

The Send Notification feature do not have it’s own cmdlet in version 6.1907.1.0 of the Intune Powershell SDK that I could find. This make sense however since the Intune Powershell SDK cmdlets gets automatically generated at the point in time when the realse of the SDK gets published. Meaning if the feature didnt exist when the cmdlet was generated it won’t be in the module.



To explain this a bit further, Microsoft uses a script to automatically generate all the cmdlets for Intune Powershell SDK which they call Intune Powershell SDK Code Generator. In theory you can run that script yourself and generate a module that contains all the latest cmdlets if needed. I haven’t tried it out myself yet so I dont have any experience using it.

The Intune Powershell SDK Code Generator can be found here:

https://github.com/microsoftgraph/Intune-PowerShell-SDK-Code-Generator

Invoke-MSGraphRequest cmdlet to send custom notification

One of the reasons why I love the Intune Powershell SDK is that it contains the Invoke-MSGraphReqeust cmdlet. This cmdlet lets us do Microsoft Graph requests that we can specify our self so we don’t need a specific cmdlet for specific feature. As in this case where we dont have a cmdlet for the custom notification function we can still do it with help of the Invoke-MSGraphRequest cmdlet.

The Script Connect-MSGraph $Resource = "deviceManagement/sendCustomNotificationToCompanyPortal" $graphApiVersion = "Beta" $uri = "https://graph.microsoft.com/$graphApiVersion/$($resource)" $TargetGroup = "083473d0-bb4a-47e0-9efb-e991e0719705" $MessageTitle = "Urgent Notification" $MessageBody = "This notification was sent through the Intune Powershell SDK, its awesome!" $JSON = @" { "notificationTitle":"$($MessageTitle)","notificationBody":"$($MessageBody)","groupsToNotify":["$($Targetgroup)"] } "@ Invoke-MSGraphRequest -HttpMethod POST -Url $uri -Content $JSON Using the script When using the script there’s only 3 components we need to take in to consideration and these 3 are represented by 3 varibles in the script. TargetGroup – Which group in Azure we will send the notification to.

MessageTitle – The title of the message

MessageBody – The content of the message In the example I provided it looks like this $TargetGroupID = "083473d0-bb4a-47e0-9efb-e991e0719705" $MessageTitle = "Urgent notification" $MessageHeader = "This notification was sent with the help of the Intune Powershell SDK, its awesome!" The TargetGroupID is the Object ID for the Azure group I want to send to. So if I look in my test tenant in Azure Once you have your Object ID, Title of the notification and the content of the message just update the varibles in the script and run the script. If you haven’t authenticated to your teneant previously you will be prompted to do so. After a couple of minutes you will see the notificaiton on your iOS or Android device. In my very limited testing it took about 5 minutes from the time I ran the script until it appeared on the device, your mileage may vary.

Lock screen on a iOS device Notification menu on a iOS device When you click on the notification it will take you to the Company portal app and you’ll see the entire message there.







Leave a comment or question in the comment section below.

That’s all for now and until next time, cheers !

Don’t forget to follow me on twitterAnd you can also find me blogging over at http://blog.ctglobalservices.com/