我使用Windows 7
我通过使用以下powershell脚本解决了它
$name = $PSScriptRoot + "\" + $MyInvocation.MyCommand.Name if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) { Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$name`"" -Verb RunAs; exit } $registryPath = "HKLM:\SYSTEM\CurrentControlSet\Control\Lsa" $Name = "LimitBlankPasswordUse" $value = "0" New-ItemProperty -Path $registryPath -Name $name -Value $value ` -PropertyType DWORD -Force | Out-Null
如果尚未在管理员模式下打开,此脚本将自动以管理员身份运行
我也试过Raf写的脚本。我有2.0版本,但我只能使用4.0版本
根据@ Kayasax的回答,没有纯粹的PowerShell方式,你必须包装 SECEDIT 进入Powershell。
secedit /export /cfg c:\secpol.cfg (gc C:\secpol.cfg).replace("PasswordComplexity = 1", "PasswordComplexity = 0") | Out-File C:\secpol.cfg secedit /configure /db c:\windows\security\local.sdb /cfg c:\secpol.cfg /areas SECURITYPOLICY rm -force c:\secpol.cfg -confirm:$false