Add one-command server and client bootstraps

This commit is contained in:
2026-09-03 16:34:21 -06:00
parent 742ae9c2b5
commit 3a10098239
19 changed files with 1569 additions and 37 deletions
+31 -1
View File
@@ -2,7 +2,8 @@
param(
[string]$TargetOuDn = 'OU=Usuarios-SGU,DC=lci,DC=lasalle,DC=mx',
[string]$GpoName = 'SGU - User session restrictions',
[string]$DomainController = $env:COMPUTERNAME
[string]$DomainController = $env:COMPUTERNAME,
[string]$WallpaperPath
)
$ErrorActionPreference = 'Stop'
@@ -81,6 +82,25 @@ if ($PSCmdlet.ShouldProcess($GpoName, 'Prevent SGU users from manually locking w
-ValueName 'ScreenSaveActive' `
-Type String `
-Value '0' | Out-Null
if ($WallpaperPath) {
Set-GPRegistryValue `
-Name $GpoName `
-Domain $domainName `
-Server $DomainController `
-Key $policyKey `
-ValueName 'Wallpaper' `
-Type String `
-Value $WallpaperPath | Out-Null
Set-GPRegistryValue `
-Name $GpoName `
-Domain $domainName `
-Server $DomainController `
-Key $policyKey `
-ValueName 'WallpaperStyle' `
-Type String `
-Value '10' | Out-Null
}
}
$configuredValue = Get-GPRegistryValue `
@@ -101,6 +121,15 @@ $link = @(Get-GPInheritance -Target $TargetOuDn -Domain $domainName -Server $Dom
$linkEnabled = $link -and (
$link.Enabled -eq $true -or
[string]$link.Enabled -eq 'Yes')
$configuredWallpaper = $null
if ($WallpaperPath) {
$configuredWallpaper = (Get-GPRegistryValue `
-Name $GpoName `
-Domain $domainName `
-Server $DomainController `
-Key $policyKey `
-ValueName 'Wallpaper').Value
}
[pscustomobject]@{
GpoName = $GpoName
@@ -109,4 +138,5 @@ $linkEnabled = $link -and (
LinkEnabled = [bool]$linkEnabled
DisableLockWorkstation = [int]$configuredValue.Value
ScreenSaverDisabled = [string]$screenSaverValue.Value -eq '0'
Wallpaper = $configuredWallpaper
}