From 748939b4045b834e5aab8e815bd9455708b576df Mon Sep 17 00:00:00 2001 From: Matthew McKinnon Date: Thu, 6 Mar 2025 13:12:13 +1000 Subject: [PATCH] chore: update ImportPolicies.ps1 to install SDK if not found --- ImportPolicies.ps1 | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ImportPolicies.ps1 b/ImportPolicies.ps1 index 4972de7..5b3944a 100644 --- a/ImportPolicies.ps1 +++ b/ImportPolicies.ps1 @@ -1,3 +1,14 @@ +# Check if the Microsoft Graph PowerShell SDK is installed +if (-not (Get-Module -ListAvailable -Name Microsoft.Graph)) { + Install-Module -Name Microsoft.Graph -Scope CurrentUser -Force +} + +# Check if the Microsoft Graph PowerShell SDK is installed +if (-not (Get-Module -ListAvailable -Name Microsoft.Graph.Beta)) { + Install-Module -Name Microsoft.Graph.Beta -Scope CurrentUser -Force +} + + # Connect to Microsoft Graph Connect-MgGraph -Scopes "DeviceManagementConfiguration.ReadWrite.All", "Organization.Read.All", "Group.ReadWrite.All", "Directory.ReadWrite.All" -NoWelcome