Skip to content

Instantly share code, notes, and snippets.

@HighLibrarian
Last active April 16, 2024 08:18
Show Gist options
  • Save HighLibrarian/7e8d78a202680e610cb26bd6313d6f7e to your computer and use it in GitHub Desktop.
Save HighLibrarian/7e8d78a202680e610cb26bd6313d6f7e to your computer and use it in GitHub Desktop.
makes intune devices sync their policies
$GroupId = "bc8b6f66-fd59-412f-9b2e-1a0de52466a5"
# Importing the SDK Module
Import-Module -Name Microsoft.Graph.DeviceManagement.Actions
Connect-MgGraph -scope DeviceManagementManagedDevices.PrivilegedOperations.All, DeviceManagementManagedDevices.ReadWrite.All,DeviceManagementManagedDevices.Read.All
#### Gets All devices
$Devices = Get-MgGroupMember -GroupId $GroupId
Foreach ($Device in $Devices)
{
Sync-MgDeviceManagementManagedDevice -ManagedDeviceId $Device
Write-Host "Sending Sync request to Device with Device name $Device" -ForegroundColor Yellow
}
Disconnect-Graph
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment