Connection & Setup Read-only
Install the Microsoft Graph PowerShell SDK Install the Microsoft.Graph module used for Entra ID and Intune automation.
Install-Module Microsoft.Graph {{Scope}} -Repository PSGallery -Force {{AllowClobber}}
Connection & Setup Read-only
Connect to Microsoft Graph (interactive sign-in) Sign in to Microsoft Graph interactively with delegated permission scopes.
Connect-MgGraph {{Scopes}} {{TenantId}}
Connection & Setup Read-only
Connect to Microsoft Graph (app-only / unattended) Authenticate non-interactively with an app registration and certificate.
Connect-MgGraph {{ClientId}} {{TenantId}} {{Thumbprint}}
Connection & Setup Read-only
Show current Graph connection context Display the signed-in account, tenant, and granted permission scopes.
Get-MgContext | Select-Object Account, TenantId, Scopes
Connection & Setup Read-only
Disconnect from Microsoft Graph Sign out and clear the current Microsoft Graph session.
Disconnect-MgGraph
Connection & Setup Read-only
Install and connect the Az PowerShell module Install the Azure Az module and sign in to manage Azure resources.
Install-Module -Name Az {{Scope}} -Repository PSGallery -Force; Connect-AzAccount {{Tenant}}
Entra ID · Users Read-only
List all Entra ID users Retrieve every user in the directory with common properties.
Get-MgUser -All {{Property}} | Select-Object DisplayName, UserPrincipalName, Id, AccountEnabled
Entra ID · Users Read-only
Find a user by UPN or attribute Search for a specific user with a server-side filter.
Get-MgUser {{Filter}} {{ConsistencyLevel}} -All
Entra ID · Users Write
Create a new Entra ID user Provision a cloud user account with a temporary password.
$pwd = @{ Password = {{Password}}; ForceChangePasswordNextSignIn = $true }
Entra ID · Users Write
Update user attributes Modify properties such as department, job title, or manager data.
Update-MgUser {{UserId}} {{Department}} {{JobTitle}} {{UsageLocation}}
Entra ID · Users Write
Disable (block sign-in for) a user Immediately block a user from signing in — a key offboarding step.
Update-MgUser {{UserId}} -AccountEnabled:$false
Entra ID · Users Read-only
Revoke a user's sign-in sessions Invalidate all refresh tokens, forcing re-authentication everywhere.
Revoke-MgUserSignInSession {{UserId}}
Entra ID · Users Write
Reset a user's password Set a new temporary password and force a change at next sign-in.
$profile = @{ Password = {{Password}}; ForceChangePasswordNextSignIn = $true }
Entra ID · Users Read-only
Get a user's manager Retrieve the manager assigned to a given user.
Get-MgUserManager {{UserId}} | Select-Object -ExpandProperty AdditionalProperties
Entra ID · Users Destructive
Delete a user Soft-delete a user account (recoverable for 30 days).
Remove-MgUser {{UserId}}
Entra ID · Groups Read-only
List groups Retrieve directory groups, optionally filtered by name.
Get-MgGroup -All {{Filter}} | Select-Object DisplayName, Id, GroupTypes, SecurityEnabled, MailEnabled
Entra ID · Groups Write
Create a security group Create an assigned security group for app, license, or Intune targeting.
New-MgGroup -DisplayName {{DisplayName}} -MailNickname {{MailNickname}} -SecurityEnabled -MailEnabled:$false {{Description}}
Entra ID · Groups Write
Create a dynamic membership group Create a group whose membership is defined by a rule (e.g. department).
New-MgGroup -DisplayName {{DisplayName}} -MailNickname {{MailNickname}} -SecurityEnabled -MailEnabled:$false -GroupTypes 'DynamicMembership' -MembershipRule {{MembershipRule}} -MembershipRuleProcessingState 'On'
Entra ID · Groups Write
Add a member to a group Add a user or device to an assigned group.
New-MgGroupMember -GroupId {{GroupId}} -DirectoryObjectId {{MemberId}}
Entra ID · Groups Read-only
List members of a group Enumerate all members of a specific group.
Get-MgGroupMember -GroupId {{GroupId}} -All | Select-Object -ExpandProperty AdditionalProperties
Entra ID · Groups Write
Remove a member from a group Remove a user or device from an assigned group.
Remove-MgGroupMemberByRef -GroupId {{GroupId}} -DirectoryObjectId {{MemberId}}
Entra ID · Devices Read-only
List all Entra ID registered devices Enumerate every device object registered or joined to the directory.
Get-MgDevice -All | Select-Object DisplayName, DeviceId, OperatingSystem, TrustType, IsCompliant, ApproximateLastSignInDateTime
Entra ID · Devices Read-only
Find stale devices (no recent sign-in) List devices that have not signed in since a chosen cutoff date.
$cutoff = (Get-Date).AddDays(-{{Days}})
Entra ID · Devices Write
Disable an Entra ID device Block a device object so it can no longer be used to access resources.
Update-MgDevice -DeviceId {{DeviceObjectId}} -AccountEnabled:$false
Entra ID · Devices Destructive
Delete an Entra ID device object Remove a stale or retired device from the directory.
Remove-MgDevice -DeviceId {{DeviceObjectId}}
Entra ID · Roles & RBAC Read-only
List active directory roles Show the administrative roles currently activated in the tenant.
Get-MgDirectoryRole -All | Select-Object DisplayName, Id, RoleTemplateId
Entra ID · Roles & RBAC Read-only
List members of a directory role See who holds a given admin role — a core privileged-access audit.
Get-MgDirectoryRoleMember -DirectoryRoleId {{RoleId}} | Select-Object -ExpandProperty AdditionalProperties
Entra ID · Roles & RBAC Write
Assign a user to a directory role Grant an admin role to a user via a role assignment.
New-MgRoleManagementDirectoryRoleAssignment -PrincipalId {{PrincipalId}} -RoleDefinitionId {{RoleDefinitionId}} -DirectoryScopeId '/'
Entra ID · Applications Read-only
List app registrations Enumerate application registrations in the tenant.
Get-MgApplication -All | Select-Object DisplayName, AppId, Id, SignInAudience, PublisherDomain
Entra ID · Applications Read-only
List service principals (enterprise apps) Enumerate service principals / enterprise applications.
Get-MgServicePrincipal -All | Select-Object DisplayName, AppId, Id, AccountEnabled, AppOwnerOrganizationId
Entra ID · Applications Read-only
Find app registrations with expiring secrets Report client secrets/certs expiring within N days.
$limit = (Get-Date).AddDays({{Days}})
Entra ID · Conditional Access Read-only
List Conditional Access policies Export all Conditional Access policies with their state.
Get-MgIdentityConditionalAccessPolicy -All | Select-Object DisplayName, State, Id, ModifiedDateTime
Entra ID · Conditional Access Write
Create an MFA Conditional Access policy Require multi-factor authentication for all users accessing all cloud apps.
$params = @{
Entra ID · Conditional Access Write
Enable or disable a Conditional Access policy Change a policy's state between enabled, report-only, and disabled.
Update-MgIdentityConditionalAccessPolicy -ConditionalAccessPolicyId {{PolicyId}} -State {{State}}
Intune · Devices Read-only
List all Intune managed devices Inventory every device enrolled in Intune with key compliance data.
Get-MgDeviceManagementManagedDevice -All | Select-Object DeviceName, OperatingSystem, OSVersion, ComplianceState, ManagedDeviceOwnerType, LastSyncDateTime, UserPrincipalName
Intune · Devices Read-only
List non-compliant devices Filter Intune devices to only those failing compliance.
Get-MgDeviceManagementManagedDevice -Filter "complianceState eq 'noncompliant'" -All | Select-Object DeviceName, UserPrincipalName, OperatingSystem, LastSyncDateTime
Intune · Devices Write
Force a device to sync (check in) with Intune Trigger an immediate policy/app sync on a managed device.
Sync-MgDeviceManagementManagedDevice -ManagedDeviceId {{ManagedDeviceId}}
Intune · Devices Write
Remotely reboot a device Send a remote restart command to a managed device.
Restart-MgDeviceManagementManagedDevice -ManagedDeviceId {{ManagedDeviceId}}
Intune · Devices Destructive
Wipe a device (factory reset) Remotely wipe a lost or retired device back to factory settings.
Clear-MgDeviceManagementManagedDevice -ManagedDeviceId {{ManagedDeviceId}} {{KeepUserData}}
Intune · Devices Write
Retire a device (remove company data) Remove company data and management while leaving personal data intact.
Invoke-MgRetireDeviceManagementManagedDevice -ManagedDeviceId {{ManagedDeviceId}}
Intune · Devices Read-only
Get a device's primary user Show which user is set as the primary user of a managed device.
Get-MgDeviceManagementManagedDeviceUser -ManagedDeviceId {{ManagedDeviceId}} | Select-Object DisplayName, UserPrincipalName, Id
Intune · Devices Read-only
Report device BitLocker / encryption state List managed devices and whether they are encrypted.
Get-MgDeviceManagementManagedDevice -All | Select-Object DeviceName, OperatingSystem, IsEncrypted, UserPrincipalName | Sort-Object IsEncrypted
Intune · Policies Read-only
List device compliance policies Enumerate all Intune compliance policies in the tenant.
Get-MgDeviceManagementDeviceCompliancePolicy -All | Select-Object DisplayName, Id, '@odata.type', LastModifiedDateTime
Intune · Policies Read-only
List device configuration profiles Enumerate configuration profiles applied to managed devices.
Get-MgDeviceManagementDeviceConfiguration -All | Select-Object DisplayName, Id, '@odata.type', LastModifiedDateTime
Intune · Policies Write
Create a Windows compliance policy Create a baseline Windows 10/11 compliance policy requiring BitLocker.
$params = @{
Intune · Policies Write
Assign a compliance policy to a group Target a compliance policy at a security group.
$assignment = @{
Intune · Policies Read-only
Report configuration profile assignments Show which groups a configuration profile is deployed to.
Get-MgDeviceManagementDeviceConfigurationAssignment -DeviceConfigurationId {{ConfigurationId}} | Select-Object Id, Target
Intune · Applications Read-only
List all Intune apps Inventory every application managed through Intune.
Get-MgDeviceAppManagementMobileApp -All | Select-Object DisplayName, Id, '@odata.type', Publisher
Intune · Applications Write
Assign an app to a group (Required install) Deploy an app as a required install to a security group.
$body = @{
Intune · Applications Read-only
Report app installation status See install success/failure counts for a deployed app.
Get-MgDeviceAppManagementMobileApp -MobileAppId {{AppId}} -ExpandProperty installSummary | Select-Object DisplayName -ExpandProperty InstallSummary
Intune · Applications Read-only
List app protection (MAM) policies Enumerate iOS and Android app protection policies.
Get-MgDeviceAppManagementiOSManagedAppProtection -All | Select-Object DisplayName, Id
Intune · Enrollment & Autopilot Read-only
List Windows Autopilot devices Show all devices registered for Windows Autopilot.
Get-MgDeviceManagementWindowsAutopilotDeviceIdentity -All | Select-Object SerialNumber, Model, Manufacturer, GroupTag, EnrollmentState
Intune · Enrollment & Autopilot Read-only
Collect the Autopilot hardware hash (on device) Export a device's hardware hash to a CSV for Autopilot registration.
Install-Script -Name Get-WindowsAutopilotInfo -Force
Intune · Enrollment & Autopilot Read-only
List enrollment status page / restrictions Enumerate device enrollment configurations (ESP, restrictions).
Get-MgDeviceManagementDeviceEnrollmentConfiguration -All | Select-Object DisplayName, Id, '@odata.type', Priority
Intune · Enrollment & Autopilot Read-only
List Autopilot deployment profiles Show configured Windows Autopilot deployment profiles.
Get-MgDeviceManagementWindowsAutopilotDeploymentProfile -All | Select-Object DisplayName, Id, DeviceNameTemplate, EnrollmentStatusScreenSettings
Local Device · Join & Identity Read-only
Check Entra ID join status (dsregcmd) Show whether a Windows device is Entra joined, hybrid joined, or registered.
dsregcmd /status
Local Device · Join & Identity Read-only
Force Entra ID join / debug registration Trigger and debug automatic Entra ID join for a device.
dsregcmd /debug /join
Local Device · Join & Identity Read-only
Join a computer to an Active Directory domain Join a Windows device to an on-prem AD domain and restart.
Add-Computer -DomainName {{DomainName}} -Credential (Get-Credential) {{OUPath}} -Restart
Local Device · Join & Identity Read-only
Check local MDM enrollment status Report the device's MDM (Intune) enrollment from the local registry.
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\Enrollments' -Recurse -ErrorAction SilentlyContinue | Get-ItemProperty | Where-Object { $_.UPN } | Select-Object UPN, ProviderID, EnrollmentState
Local Device · Join & Identity Read-only
Trigger MDM/Intune sync locally (deviceenroller) Kick off an Intune policy sync from the device itself.
Get-ScheduledTask | Where-Object { $_.TaskName -eq 'PushLaunch' } | Start-ScheduledTask
Local Device · Administration Read-only
Get full local computer information Dump hardware, OS, BIOS, and domain info for the local machine.
Get-ComputerInfo | Select-Object CsName, WindowsProductName, OsVersion, OsBuildNumber, CsManufacturer, CsModel, BiosSerialNumber, CsDomain
Local Device · Administration Read-only
Retrieve local BitLocker recovery key Show BitLocker protection status and recovery password for a drive.
Get-BitLockerVolume -MountPoint {{MountPoint}} | Select-Object MountPoint, VolumeStatus, ProtectionStatus, EncryptionPercentage -ExpandProperty KeyProtector
Local Device · Administration Read-only
List local Administrators group members Audit who has local admin rights on the device.
Get-LocalGroupMember -Group 'Administrators'
Local Device · Administration Write
Add a user to a local group Grant a domain/Entra user membership in a local group.
Add-LocalGroupMember -Group {{Group}} -Member {{Member}}
Local Device · Administration Read-only
Check and restart a Windows service Inspect a service and restart it if it is not running.
Get-Service -Name {{ServiceName}} | Format-List Status, Name, DisplayName
Local Device · Administration Read-only
Query recent system errors from the event log Pull the most recent error-level events from the System log.
Get-WinEvent -FilterHashtable @{ LogName = {{LogName}}; Level = 2 } -MaxEvents {{MaxEvents}} | Select-Object TimeCreated, Id, ProviderName, Message
Local Device · Administration Read-only
Install software with winget Silently install an application via the Windows Package Manager.
winget install --id {{PackageId}} --silent --accept-package-agreements --accept-source-agreements
Local Device · Administration Read-only
Check pending Windows Updates List available/pending Windows updates on the local device.
Install-Module PSWindowsUpdate -Scope CurrentUser -Force
Remote Management Read-only
Enable PowerShell Remoting on a device Turn on WinRM so the device can accept remote PowerShell sessions.
Enable-PSRemoting -Force {{SkipNetworkProfileCheck}}
Remote Management Read-only
Open an interactive remote session Start an interactive PowerShell session on a remote computer.
Enter-PSSession -ComputerName {{ComputerName}} -Credential (Get-Credential) {{UseSSL}}
Remote Management Read-only
Run a command on one or many remote devices Execute a script block against remote computers in parallel.
Invoke-Command -ComputerName {{ComputerNames}} -Credential (Get-Credential) -ScriptBlock { {{ScriptBlock}} }
Remote Management Read-only
Query remote hardware/OS with CIM Pull WMI/CIM data (serial, model, OS) from a remote device.
Get-CimInstance -ComputerName {{ComputerName}} -ClassName {{ClassName}} | Select-Object *
Remote Management Read-only
Test connectivity to a remote host Ping-style reachability and latency check to a host.
Test-Connection -TargetName {{TargetName}} -Count {{Count}}
Reporting & Data Export Read-only
Export Entra ID sign-in logs Pull recent interactive sign-in events for auditing.
Get-MgAuditLogSignIn -Filter {{Filter}} -Top {{Top}} | Select-Object CreatedDateTime, UserPrincipalName, AppDisplayName, @{n='Status';e={$_.Status.ErrorCode}}, IpAddress
Reporting & Data Export Read-only
Export directory audit logs Retrieve who changed what in the directory (config changes).
Get-MgAuditLogDirectoryAudit -Top {{Top}} | Select-Object ActivityDateTime, ActivityDisplayName, @{n='Initiator';e={$_.InitiatedBy.User.UserPrincipalName}}, Result
Reporting & Data Export Read-only
Report assigned licenses (SKU usage) Show consumed vs available license units per SKU.
Get-MgSubscribedSku | Select-Object SkuPartNumber, @{n='Enabled';e={$_.PrepaidUnits.Enabled}}, ConsumedUnits
Reporting & Data Export Read-only
Export all users to CSV Save a full user directory export to a CSV file.
Get-MgUser -All -Property DisplayName,UserPrincipalName,Department,JobTitle,AccountEnabled | Select-Object DisplayName, UserPrincipalName, Department, JobTitle, AccountEnabled | Export-Csv -Path {{Path}} -NoTypeInformation -Encoding UTF8
Reporting & Data Export Read-only
Export Intune device inventory to CSV Save the full managed-device inventory to a CSV file.
Get-MgDeviceManagementManagedDevice -All | Select-Object DeviceName, UserPrincipalName, OperatingSystem, OSVersion, ComplianceState, LastSyncDateTime | Export-Csv -Path {{Path}} -NoTypeInformation -Encoding UTF8
Reporting & Data Export Read-only
Call any Graph endpoint directly (Invoke-MgGraphRequest) Run a raw GET against any Microsoft Graph URL for custom data.
Invoke-MgGraphRequest -Method GET -Uri {{Uri}} -OutputType PSObject | Select-Object -ExpandProperty value