|
|
@@ -61,15 +61,29 @@ elseif (-not $existingLinkEnabled -and
|
|
|
|
|
|
|
|
|
|
|
|
$dataCollectionKey = 'HKLM\Software\Policies\Microsoft\Windows\DataCollection'
|
|
|
|
$dataCollectionKey = 'HKLM\Software\Policies\Microsoft\Windows\DataCollection'
|
|
|
|
$powerPolicyRoot = 'HKLM\Software\Policies\Microsoft\Power\PowerSettings'
|
|
|
|
$powerPolicyRoot = 'HKLM\Software\Policies\Microsoft\Power\PowerSettings'
|
|
|
|
|
|
|
|
$credentialProviderPolicyKey = 'HKLM\Software\Policies\Microsoft\Windows\System'
|
|
|
|
|
|
|
|
$interactiveLogonPolicyKey = 'HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System'
|
|
|
|
|
|
|
|
$accountPicturePolicyKey = 'HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer'
|
|
|
|
|
|
|
|
$providerClassId = '{D789CFD8-5AD4-489F-9B83-7EB5D9D09335}'
|
|
|
|
$policies = @(
|
|
|
|
$policies = @(
|
|
|
|
@{ Key = $dataCollectionKey; Name = 'AllowTelemetry'; Value = 0 },
|
|
|
|
@{ Key = $dataCollectionKey; Name = 'AllowTelemetry'; Type = 'DWord'; Value = 0 },
|
|
|
|
@{ Key = $dataCollectionKey; Name = 'DisableTelemetryOptInSettingsUx'; Value = 1 },
|
|
|
|
@{ Key = $dataCollectionKey; Name = 'DisableTelemetryOptInSettingsUx'; Type = 'DWord'; Value = 1 },
|
|
|
|
@{ Key = $dataCollectionKey; Name = 'DisableTelemetryOptInChangeNotification'; Value = 1 },
|
|
|
|
@{ Key = $dataCollectionKey; Name = 'DisableTelemetryOptInChangeNotification'; Type = 'DWord'; Value = 1 },
|
|
|
|
@{ Key = $dataCollectionKey; Name = 'DisableDiagnosticDataViewer'; Value = 1 },
|
|
|
|
@{ Key = $dataCollectionKey; Name = 'DisableDiagnosticDataViewer'; Type = 'DWord'; Value = 1 },
|
|
|
|
@{ Key = 'HKLM\Software\Policies\Microsoft\Windows\OOBE'; Name = 'DisablePrivacyExperience'; Value = 1 },
|
|
|
|
@{ Key = 'HKLM\Software\Policies\Microsoft\Windows\OOBE'; Name = 'DisablePrivacyExperience'; Type = 'DWord'; Value = 1 },
|
|
|
|
@{ Key = 'HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System'; Name = 'EnableFirstLogonAnimation'; Value = 0 },
|
|
|
|
@{ Key = $interactiveLogonPolicyKey; Name = 'EnableFirstLogonAnimation'; Type = 'DWord'; Value = 0 },
|
|
|
|
@{ Key = 'HKLM\Software\Policies\Microsoft\Windows\LocationAndSensors'; Name = 'DisableLocation'; Value = 1 },
|
|
|
|
@{ Key = 'HKLM\Software\Policies\Microsoft\Windows\LocationAndSensors'; Name = 'DisableLocation'; Type = 'DWord'; Value = 1 },
|
|
|
|
@{ Key = 'HKLM\Software\Policies\Microsoft\Windows\AppPrivacy'; Name = 'LetAppsAccessLocation'; Value = 2 }
|
|
|
|
@{ Key = 'HKLM\Software\Policies\Microsoft\Windows\AppPrivacy'; Name = 'LetAppsAccessLocation'; Type = 'DWord'; Value = 2 },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Enrollment selects the provider before domain join; this computer GPO
|
|
|
|
|
|
|
|
# becomes the authoritative, self-healing configuration afterwards.
|
|
|
|
|
|
|
|
@{ Key = $credentialProviderPolicyKey; Name = 'DefaultCredentialProvider'; Type = 'String'; Value = $providerClassId },
|
|
|
|
|
|
|
|
@{ Key = $credentialProviderPolicyKey; Name = 'EnumerateLocalUsers'; Type = 'DWord'; Value = 0 },
|
|
|
|
|
|
|
|
@{ Key = $interactiveLogonPolicyKey; Name = 'DontDisplayLastUserName'; Type = 'DWord'; Value = 1 },
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Use Windows' native default account image for named user tiles. LogonUI
|
|
|
|
|
|
|
|
# retains ownership of the anonymous Other user tile and its circular mask.
|
|
|
|
|
|
|
|
@{ Key = $accountPicturePolicyKey; Name = 'UseDefaultTile'; Type = 'DWord'; Value = 1 }
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
$powerSettingIds = @(
|
|
|
|
$powerSettingIds = @(
|
|
|
@@ -80,8 +94,8 @@ $powerSettingIds = @(
|
|
|
|
)
|
|
|
|
)
|
|
|
|
foreach ($settingId in $powerSettingIds) {
|
|
|
|
foreach ($settingId in $powerSettingIds) {
|
|
|
|
$settingKey = "$powerPolicyRoot\$settingId"
|
|
|
|
$settingKey = "$powerPolicyRoot\$settingId"
|
|
|
|
$policies += @{ Key = $settingKey; Name = 'ACSettingIndex'; Value = 0 }
|
|
|
|
$policies += @{ Key = $settingKey; Name = 'ACSettingIndex'; Type = 'DWord'; Value = 0 }
|
|
|
|
$policies += @{ Key = $settingKey; Name = 'DCSettingIndex'; Value = 0 }
|
|
|
|
$policies += @{ Key = $settingKey; Name = 'DCSettingIndex'; Type = 'DWord'; Value = 0 }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($policy in $policies) {
|
|
|
|
foreach ($policy in $policies) {
|
|
|
@@ -92,7 +106,7 @@ foreach ($policy in $policies) {
|
|
|
|
-Server $DomainController `
|
|
|
|
-Server $DomainController `
|
|
|
|
-Key $policy.Key `
|
|
|
|
-Key $policy.Key `
|
|
|
|
-ValueName $policy.Name `
|
|
|
|
-ValueName $policy.Name `
|
|
|
|
-Type DWord `
|
|
|
|
-Type $policy.Type `
|
|
|
|
-Value $policy.Value | Out-Null
|
|
|
|
-Value $policy.Value | Out-Null
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@@ -105,7 +119,7 @@ foreach ($policy in $policies) {
|
|
|
|
-Server $DomainController `
|
|
|
|
-Server $DomainController `
|
|
|
|
-Key $policy.Key `
|
|
|
|
-Key $policy.Key `
|
|
|
|
-ValueName $policy.Name
|
|
|
|
-ValueName $policy.Name
|
|
|
|
$configuredPolicies[$policy.Name + '@' + $policy.Key] = [int]$configured.Value
|
|
|
|
$configuredPolicies[$policy.Name + '@' + $policy.Key] = $configured.Value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$link = @(Get-GPInheritance -Target $TargetOuDn -Domain $domainName -Server $DomainController).GpoLinks |
|
|
|
|
$link = @(Get-GPInheritance -Target $TargetOuDn -Domain $domainName -Server $DomainController).GpoLinks |
|
|
|
|
Where-Object DisplayName -eq $GpoName |
|
|
|
|
Where-Object DisplayName -eq $GpoName |
|
|
|
|