我需要能夠更改本地用戶組屬性區域中的PasswordNeverExpires選項。通過Powershell爲本地用戶組設置PasswordNeverExpires標誌
我已經知道我將不得不爲了執行此操作使用標誌在文章中指出:
How to use the UserAccountControl flags to manipulate user account properties
我將如何能夠針對用戶有問題通過Powershell腳本?
感謝
我需要能夠更改本地用戶組屬性區域中的PasswordNeverExpires選項。通過Powershell爲本地用戶組設置PasswordNeverExpires標誌
我已經知道我將不得不爲了執行此操作使用標誌在文章中指出:
How to use the UserAccountControl flags to manipulate user account properties
我將如何能夠針對用戶有問題通過Powershell腳本?
感謝
我想通了。
下面是詳細信息的鏈接:
[Win 7] setting the option "Password never expires" for a specific local user
基本上,你會創建一個腳本,像這樣:
$user = [adsi]"WinNT://$env:computername/administrator"
$user.UserFlags.value = $user.UserFlags.value -bor 0x10000
$user.CommitChanges()
,然後運行它,確保您替換'管理員「與有問題的用戶。
這也行得通。
Set-LocalUser -Name "Administrator" -PasswordNeverExpires:$true
參見:https://technet.microsoft.com/en-us/library/mt651674.aspx?f=255&MSPPError=-2147217396