Windows Server 2016-批量设置用户下次登陆须更改密码

 

Windows Server 2016-批量设置用户下次登陆须更改密码

https://blog.csdn.net/weixin_34233856/article/details/92367828

Powershell设置某OU下所有用户下次登陆必须更改密码:

Get-ADUser -Filter * -SearchBase "ou=syncall,dc=azureyun,dc=com" |Set-ADUser -ChangePasswordAtLogon $flase

批量取消当前域环境中已勾选下次登陆必须更改密码选项:

Get-ADUser -Filter * | foreach {Set-ADUser -Identity $_.SamAccountName -ChangePasswordAtLogon $false}

参考网站

Modifying an Attribute for Several Users at Once

https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/dd391846(v=ws.10)?redirectedfrom=MSDN

  • 07/02/2012
  • 2 minutes to read

Applies To: Windows Server 2008 R2

This topic explains how to use the Active Directory module for Windows PowerShell to modify an attribute in Active Directory Domain Services (AD DS) for several users at once.

Example

The following example demonstrates how to retrieve the user objects in the organizational unit (OU) Finance and set their description attribute:

Get-ADUser -Filter 'Name -like "*"' -SearchBase "OU=Finance,OU=UserAccounts,DC=FABRIKAM,DC=COM" | Set-ADUser -Description "Member of the Finance Department"

Additional information

You can use the following parameters when you set many of the common values that are associated with a user object in AD DS:

  • -AccountExpirationDate

  • -AccountNotDelegated

  • -AccountPassword

  • -AllowReversiblePasswordEncryption

  • -CannotChangePassword

  • -ChangePasswordAtLogon

  • -Enabled

  • -PasswordNeverExpires

  • -PasswordNotRequired

  • -SmartcardLogonRequired

  • -TrustedForDelegation

  • -DisplayName

  • -GivenName

  • -Initials

  • -OtherName

  • -Surname

  • -Description

  • -City

  • -Country

  • -POBox

  • -PostalCode

  • -State

  • -StreetAddress

  • -Company

  • -Department

  • -Division

  • -EmployeeID

  • -EmployeeNumber

  • -Manager

  • -Office

  • -Organization

  • -Title

  • -Fax

  • -HomePhone

  • -MobilePhone

  • -OfficePhone

  • -EmailAddress

  • -HomeDirectory

  • -HomeDrive

  • -HomePage

  • -ProfilePath

  • -ScriptPath

  • -Certificates

  • -LogonWorkstations

  • -PermittedLogonTimes

  • -UserPrincipalName

  • -ServicePrincipalNames

In addition to the standard Lightweight Directory Access Protocol (LDAP) attributes, you can retrieve the following extended properties of the Get-ADUser cmdlet by using the -Properties parameter:

  • City

  • Country

  • EmailAddress

  • Fax

  • LogonWorkstations

  • MobilePhone

  • Office

  • OfficePhone

  • Organization

  • OtherName

  • POBox

  • SmartcardLogonRequired

  • State

  • Surname

For a full explanation of the parameters that you can pass to Set-ADUser or Get-ADUser, at the Active Directory module command prompt, type Get-Help Set-ADUser –detailed or Get-Help Get-ADUser –detailed, and then press ENTER.

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值