I’ve uploaded a new connection to Intune script that is freely available on my Github repository. You’ll find it here:
https://github.com/directorcia/Office365/blob/master/Intune-connect.ps1
Once it has been run you can run commands like:
get-autopilotprofile
as shown above.
To allow this script to operate correctly you’ll need the following two modules installed:
WindowsAutoPilotIntune
and
Microsoft.Graph.Intune
Both of these will be installed as part of my o365-setup.ps1 and o365-update.ps1 scripts, which are also freely available.
I’ve also added this Intune connection script to the connection selector script (c.ps1) in the same repository.
When intune-connect.ps1 runs you’ll be prompted for your credentials as normal.
Then you password and MFA if required.
Because connection to Intune via PowerShell now uses the Microsoft Graph, you’ll need to allow the above permissions as shown once.
You’ll find those permissions, when you accepted them, in Azure AD, User, Applications as shown above inside the Azure portal. In there will be an application called Microsoft Intune PowerShell as shown above.
If you select that Microsoft Intune PowerShell and scroll down to the bottom of the screen that is displayed, you can select a link View granted permissions as shown above.
You will then see all the permission granted to that user for accessing the Graph. You can also remove these if you ever want to as well here.
Having access to Intune and Autopilot via PowerShell will make automating device management much easier.
2 thoughts on “New Intune connection PowerShell script”