为所有指定用户重置密码

The Set-OSCADAccountPassword function

To display help about the  Set-OSCADAccountPassword function, run the following command:
                 Get-Help Set-OSCADAccountPassword -Full 
 
Example 02How to reset password for specified users.
 To reset password for specified users, should put these user’s  SamAccountName in  a CSV file, then run the following command:
   Set-OSCADAccountPassword -path "c:\Userlist.csv"
Note first, you need to prepare a CSV file,  its format appears as below. One user per line. The “Password” column is optional, if you leave it empty, this command will help you to generate a random password with 10 characters, 7 char are alphanumeric, the rest are NONalphanumeric. Both format A and format B are allowed
 

SamAccountName
Password
 SamAccountName of user, who should reset password
 The new password you want to set

 

               
 
 
 Format A                                                            Format B
B efore run this command, prepare a CSV file show as below:
Then run the command: Set-OSCADAccountPassword -path "c:\Userlist.csv"

Finally, a CSV file will be created on “C:\”, which contains user SamAccountName and new password.
Example 03 How to reset password for all users in specified OUs and their sub OU 
To reset password for all users in specified OUs and their sub OU, run the following command:  
  Set-OSCADAccountPassword –OrganizationalUnit “testou1”,   "testou2" -Recurse
Note AD structure show as below
  
Example 04How to reset password to “P@Ssw0rd” for all users in specified OU, and indicate the path of result CSV file.
To reset password to “P@Ssw0rd” for all users in OU “TestOU” and indicate the path of CSV file to “c:\report\result.csv”, run the following command: 
  Set-OSCADAccountPassword –OrganizationalUnit “testou" -Password "P@Ssw0rd" –CSVPath “c:\report\result.csv”
  
  

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值