Skip to content

Commit

Permalink
Ignore createdDateTime and lastModifiedDateTime
Browse files Browse the repository at this point in the history
Ignore two fields causing import errors
  • Loading branch information
AlwaysLearningTech committed Aug 23, 2020
1 parent bcc178a commit ef3bd7c
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions Extensions/AppProtection.psm1
Expand Up @@ -260,6 +260,8 @@ function Import-AppProtection
# Remove apps properties
Remove-ObjectProperty $obj "apps"
Remove-ObjectProperty $obj "apps@odata.context"
Remove-ObjectProperty $obj "createdDateTime"
Remove-ObjectProperty $obj "lastModifiedDateTime"
}

Write-Status "Import $($obj.displayName)"
Expand Down
2 changes: 1 addition & 1 deletion Extensions/AutoPilot.psm1
Expand Up @@ -203,7 +203,7 @@ function Import-AutoPilot

Write-Status "Import $($obj.displayName)"

Invoke-GraphRequest -Url "/deviceManagement/windowsAutopilotDeploymentProfiles" -Content (ConvertTo-Json $obj -Depth 5) -HttpMethod POST
Invoke-GraphRequest -Url "/deviceManagement/windowsAutopilotDeploymentProfiles" -Content (ConvertTo-Json ($obj | Select-Object -Property * -ExcludeProperty createdDateTime, lastModifiedDateTime) -Depth 5) -HttpMethod POST
}

function Import-AllAutoPilotObjects
Expand Down
2 changes: 1 addition & 1 deletion Extensions/CompliancePolicies.psm1
Expand Up @@ -201,7 +201,7 @@ function Import-CompliancePolicy
{
param($obj)

$json = ConvertTo-Json $obj -Depth 5
$json = ConvertTo-Json ($obj | Select-Object -Property * -ExcludeProperty createdDateTime, lastModifiedDateTime) -Depth 5
$json = $json.Trim().TrimEnd('}').Trim()
$json += @"
,
Expand Down
2 changes: 1 addition & 1 deletion Extensions/ConfigurationItems.psm1
Expand Up @@ -214,7 +214,7 @@ function Import-DeviceConfiguration

Write-Status "Import $($obj.displayName)"

Invoke-GraphRequest -Url "/deviceManagement/deviceConfigurations" -Content (ConvertTo-Json $obj -Depth 5) -HttpMethod POST
Invoke-GraphRequest -Url "/deviceManagement/deviceConfigurations" -Content (ConvertTo-Json ($obj | Select-Object -Property * -ExcludeProperty createdDateTime, lastModifiedDateTime) -Depth 5) -HttpMethod POST
}

function Import-AllDeviceConfigurationObjects
Expand Down
2 changes: 1 addition & 1 deletion Extensions/GroupPolicy.psm1
Expand Up @@ -262,7 +262,7 @@ function Import-GPOSetting
Write-Status "Import $($obj.displayName)"

# Import Administrative Template profile
$response = Invoke-GraphRequest -Url "/deviceManagement/groupPolicyConfigurations" -Content (ConvertTo-Json $obj -Depth 5) -HttpMethod POST
$response = Invoke-GraphRequest -Url "/deviceManagement/groupPolicyConfigurations" -Content (ConvertTo-Json ($obj | Select-Object -Property * -ExcludeProperty createdDateTime, lastModifiedDateTime) -Depth 5) -HttpMethod POST

if($response)
{
Expand Down
1 change: 1 addition & 0 deletions Extensions/MSGraphIntune.psm1
Expand Up @@ -1515,6 +1515,7 @@ function Import-GraphAssignments
$targets = ""
$assignments | ForEach-Object {
Remove-ObjectProperty $PSItem "Id"
Remove-ObjectProperty $PSItem "lastModifiedDateTime"
if($assignmentObjectType)
{
$PSItem | Add-Member -MemberType NoteProperty -Name "@odata.type" -Value $assignmentObjectType
Expand Down

0 comments on commit ef3bd7c

Please sign in to comment.