powershell-intune-samples icon indicating copy to clipboard operation
powershell-intune-samples copied to clipboard

DeviceConfiguration_Export.ps1 does not export profiles that are type Administrative template

Open aseflova opened this issue 4 years ago • 5 comments

When configuration profiles are exported via script DeviceConfiguration_Export.ps1, all profiles are exported except Administrative templates.

aseflova avatar Sep 08 '21 16:09 aseflova

There is a good one here that may help: https://github.com/sandytsang/MSIntune/tree/master/Intune-PowerShell/DeviceConfiguration

This exports the admin templates to folders/files on your local machine. Can be easily imported too.

SGeeves avatar Sep 08 '21 20:09 SGeeves

There is a good one here that may help: https://github.com/sandytsang/MSIntune/tree/master/Intune-PowerShell/DeviceConfiguration

This exports the admin templates to folders/files on your local machine. Can be easily imported too.

Yes thank you, I have found it also, just was surprised that the MS version does not include it as well.

aseflova avatar Sep 09 '21 13:09 aseflova

If you prefer to contain it into a script. You just run a single export then build it into a PowerShell script

I first use the functions from the link I sent ( https://github.com/sandytsang/MSIntune/tree/master/Intune-PowerShell/DeviceConfiguration) to pull the JSON files.

I then use the 2 functions that are provided for the re-import (Provided in the above link) Create-GroupPolicyConfigurations Create-GroupPolicyConfigurationsDefinitionValues

Using the exported JSON files, you can create your own within a script. Example below is a single definition value.

$MSAccessTrustCentre_AllowNetworkLocations = @" { "[email protected]": "https://graph.microsoft.com/beta/deviceManagement/groupPolicyDefinitions('3892f4ca-286f-4641-92e8-948376f6c8d5')", "enabled": "true" } "@

You can then use something like the below to create the policy and add the values;

Create-GroupPolicyConfigurations -DisplayName "NameOfPolicy" $ODConfig = Get-GroupPolicyConfigurations | Where-Object {$_.displayname -like "NameOfPolicy"} $ODConfigId = $ODConfig.id Create-GroupPolicyConfigurationsDefinitionValues -GroupPolicyConfigurationID $ODConfigId -JSON $MSAccessTrustCentre_AllowNetworkLocations

Then just add in more definition values using the same Create-GroupPolicyConfigurationDefinitionValues

SGeeves avatar Sep 09 '21 23:09 SGeeves

It would be nice if this could be added / fixed (how ever you want to call it), so that the Administrative templates can also be exported & imported

michaelulmer avatar Jun 26 '22 18:06 michaelulmer

Hi, i have this same problem with export Administrative Templates and Settings catalog

Martinfx avatar Sep 15 '22 09:09 Martinfx