Compare commits

...
1 Commits
Author SHA1 Message Date
alexrg acfdcd5bbf Fix institutional sign-in rollout and default selection 2026-09-22 16:29:09 -06:00
4 changed files with 39 additions and 6 deletions

No files matched your search

@@ -1,12 +1,12 @@
[CmdletBinding(SupportsShouldProcess)]
param(
[string]$Version = '0.6.14',
[string]$Version = '0.6.15',
[ValidatePattern('^https://')]
[string]$ClientPackageUri = 'https://gitea.lci.ulsa.mx/alexrg/SGU-CredentialProvider/releases/download/v0.6.14/sgu-windows-client-bootstrap-0.6.14.zip',
[string]$ClientPackageUri = 'https://gitea.lci.ulsa.mx/alexrg/SGU-CredentialProvider/releases/download/v0.6.15/sgu-windows-client-bootstrap-0.6.15.zip',
[ValidatePattern('^[0-9A-Fa-f]{64}$')]
[string]$ClientPackageSha256 = 'A409BC60E90EB13029945FCBBAAC3F17547F98ACE9D58032673F2F9350D17669',
[string]$ClientPackageSha256 = 'A5684FD1C196672F005517EB8E21D345BB0707091B59E203627995FF88001A11',
[string]$GpoName = 'SGU - Credential Provider update',
@@ -135,7 +135,33 @@ if ($PSCmdlet.ShouldProcess($startupPath, "Install '$scriptName' as a computer s
New-Item -ItemType Directory -Path $startupPath -Force | Out-Null
[IO.File]::WriteAllText($scriptPath, $startupScript, [Text.UTF8Encoding]::new($false))
$scriptsIni = "[Startup]`r`n0CmdLine=$scriptName`r`n0Parameters=`r`n"
[IO.File]::WriteAllText($powershellScriptsIniPath, $scriptsIni, [Text.UTF8Encoding]::new($false))
# Windows' Scripts CSE requires UTF-16LE with a BOM for psscripts.ini.
[IO.File]::WriteAllText($powershellScriptsIniPath, $scriptsIni, [Text.Encoding]::Unicode)
# Writing SYSVOL directly does not register the Scripts CSE in the GPO's
# Active Directory object. Without it, gpresult lists the GPO but the
# client never executes its startup script.
$gpoDn = "CN={$($gpo.Id)},CN=Policies,CN=System,$domainDn"
$gpoObject = Get-ADObject -Identity $gpoDn -Server $DomainController `
-Properties gPCMachineExtensionNames,versionNumber
$scriptExtension = '[{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B6664F-4972-11D1-A7CA-0000F87571E3}]'
$extensionNames = [string]$gpoObject.gPCMachineExtensionNames
if ($extensionNames.IndexOf($scriptExtension, [StringComparison]::OrdinalIgnoreCase) -lt 0) {
Set-ADObject -Identity $gpoDn -Server $DomainController `
-Replace @{gPCMachineExtensionNames = "$extensionNames$scriptExtension"}
}
# Keep the AD and SYSVOL computer versions synchronized and force clients
# to process this corrected script registration on their next refresh.
$gptIniPath = Join-Path (Split-Path (Split-Path $gpoScriptsPath -Parent) -Parent) 'GPT.ini'
$gptIni = Get-Content -LiteralPath $gptIniPath -Raw
$gptVersion = [int]([regex]::Match($gptIni, '(?m)^Version=(\d+)\r?$').Groups[1].Value)
$adVersion = [int]$gpoObject.versionNumber
$baseVersion = [Math]::Max($gptVersion, $adVersion)
$nextVersion = ($baseVersion -band -65536) -bor (($baseVersion + 1) -band 65535)
$updatedGptIni = [regex]::Replace($gptIni, '(?m)^Version=\d+\r?$', "Version=$nextVersion")
[IO.File]::WriteAllText($gptIniPath, $updatedGptIni, [Text.Encoding]::ASCII)
Set-ADObject -Identity $gpoDn -Server $DomainController -Replace @{versionNumber = $nextVersion}
}
[pscustomobject]@{
@@ -43,7 +43,12 @@ public sealed class SguCredentialProvider : CredentialProviderBase
public override bool ShouldIncludeGenericTile() => true;
public override CredentialTile CreateGenericTile() => new SguCredentialTile(this);
public override CredentialTile CreateGenericTile()
{
SguCredentialTile tile = new(this);
DefaultTile = tile;
return tile;
}
public override CredentialTile2 CreateUserTile(CredentialProviderUser user) =>
new SguCredentialTile(this, user);
@@ -89,7 +89,7 @@ internal sealed class SguCredentialTile : CredentialTile3
userName,
securePassword,
decision.Kind == BrokerDecisionKind.Unavailable
? "El servicio SGU no está disponible; Windows validará la contraseña guardada en el dominio."
? "El servicio institucional no está disponible; Windows validará la contraseña guardada en el dominio."
: null);
}
finally
@@ -89,6 +89,8 @@ internal static class Program
bool passed = fieldCount == ExpectedLabels.Length &&
credentialCount == 1 &&
defaultIndex == 0 &&
autoLogon == 0 &&
credential != IntPtr.Zero &&
providerLogoPresent &&
!userTilePresent &&