Public/Start-IntuneRestoreAssignments.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
function Start-IntuneRestoreAssignments() {
    <#
    .SYNOPSIS
    Restore Intune Configuration Assignments
     
    .DESCRIPTION
    Restore Intune Configuration Assignments
     
    .PARAMETER Path
    Path where backup (JSON) files are located.
     
    .EXAMPLE
    Start-IntuneRestoreAssignments -Path C:\temp -RestoreById $false
     
    .NOTES
    Requires the MSGraphFunctions PowerShell Module
 
    Connect to MSGraph first, using the 'Connect-Graph' cmdlet.
 
    Set $RestoreById to $true, if the Configuration itself was not restored from backup. Set $RestoreById to $false if the configurations have been re-created (new unique ID's).
    #>

    
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]$Path,

        [Parameter(Mandatory = $false)]
        [bool]$RestoreById = $false
    )

    Invoke-IntuneRestoreClientAppAssignment -Path $path -RestoreById $restoreById
    Invoke-IntuneRestoreDeviceCompliancePolicyAssignment -Path $path -RestoreById $restoreById
    Invoke-IntuneRestoreDeviceConfigurationAssignment -Path $path -RestoreById $restoreById
    Invoke-IntuneRestoreDeviceManagementScriptAssignment -Path $path -RestoreById $restoreById
    Invoke-IntuneRestoreGroupPolicyConfigurationAssignment -Path $path -RestoreById $restoreById
}