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