Improve domain enrollment and desktop personalization

This commit is contained in:
2026-09-07 15:07:04 -06:00
parent c737bd3192
commit 9f32ed2cb1
30 changed files with 1259 additions and 51 deletions
+14 -1
View File
@@ -3,7 +3,8 @@ param(
[string]$TargetOuDn = 'OU=Usuarios-SGU,DC=lci,DC=lasalle,DC=mx',
[string]$GpoName = 'SGU - User session restrictions',
[string]$DomainController = $env:COMPUTERNAME,
[string]$WallpaperPath
[string]$WallpaperPath,
[switch]$ClearManagedWallpaper
)
$ErrorActionPreference = 'Stop'
@@ -115,6 +116,17 @@ if ($PSCmdlet.ShouldProcess($GpoName, 'Prevent SGU users from manually locking w
-Type String `
-Value '10' | Out-Null
}
elseif ($ClearManagedWallpaper) {
foreach ($wallpaperValueName in 'Wallpaper','WallpaperStyle') {
Remove-GPRegistryValue `
-Name $GpoName `
-Domain $domainName `
-Server $DomainController `
-Key $policyKey `
-ValueName $wallpaperValueName `
-ErrorAction SilentlyContinue | Out-Null
}
}
}
$configuredValue = Get-GPRegistryValue `
@@ -166,4 +178,5 @@ if ($WallpaperPath) {
ScreenSaverDisabled = [string]$screenSaverValue.Value -eq '0'
DarkMode = ([int]$appsThemeValue.Value -eq 0) -and ([int]$systemThemeValue.Value -eq 0)
Wallpaper = $configuredWallpaper
DynamicWallpaperAllowed = -not [bool]$configuredWallpaper
}