fleet/ee/server/service/embedded_scripts/windows_unlock.ps1
Dante Catalfamo 5413f8d2b2
Windows locking script was missing from embedded script (#20427)
As part of this PR #20224, I added the new script to one location but
didn't notice that it wasn't included in the embedded scripts directory.

This also adds an unlock script that will reset the registry values to
their original settings
2024-07-18 11:50:12 -04:00

21 lines
785 B
PowerShell

# PowerShell script to enable all disabled local user accounts
# Get all local user accounts
$localUsers = Get-LocalUser
# Enable each disabled user account
foreach ($user in $localUsers) {
if ($user.Enabled -eq $false) {
Enable-LocalUser -Name $user.Name
Write-Host "Enabled user account: $($user.Name)"
}
}
Write-Host "All disabled user accounts have been enabled."
# Re-enable additional AD logins
New-ItemProperty -Path "HKLM:\Software\Microsoft\PolicyManager\default\Settings\AllowSignInOptions" -Name 'value' -Value 0 -PropertyType DWORD -Force
# Re-enable cached logins for AD/Azure/Entra accounts
New-ItemProperty -Path "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Winlogon\" -Name 'CachedLogonsCount' -Value 10 -PropertyType String -Force