AD 密码过期查询
- 单个AD 账号查询
net user %USERNAME% /domain
例如:
PS C:\Windows\system32> net user lansz /domain 这项请求将在域 jx.cn 的域控制器处理。 用户名 lansz 全名 Lan ShunZhou 注释 兰顺舟 …more ...
powershell:远程连接服务器
(1)在server端输入“Enable-PSRometing”,启用远程连接;
(2)在client端输入set-item wsman:\localhost\client\trustehosts –value “192.168.11.53”,将server设置为client的信任主机。
(3)输入“enter-pssession –computername 192.168.11.53 –credentrial contoso.test\administrator”,输入密码后即可远程登入server;
PS快速解锁AD 账号
查找账号: get-aduser -f {name -like '*santa*'} | format-list name,samaccountname
1.查询账号是否被锁定
Get-ADUser sean.shen -Properties * | Select-Object lockedout
解锁账号
Unlock-ADAccount -Identity sean.shen
powershell 批量更新用户账号属性
命令:
Import-Csv 'd:\phone.csv' | % { Set-ADUser -identity $_.'samaccountname' -mobilephone $_.'mobilephone' -OfficePhone $_.officephone }
phone.csv 内容如下:
samaccountname,MobilePhone,officephone
account,(86) 21 1234567 ,(86) 098765454331
Powershell 添加ad 组成员
Add-ADGroupMember -Identity <Groupname> -Members <useraccount>,<useraccount>,<useraccount>
参考地址:https://technet.microsoft.com/zh-cn/library/hh852331.aspx
more ...Powershell 命令获取AD 组信息
Poweshell 命令获取AD 组信息
Get-ADGroup -Filter * -SearchBase "ou=Distribution,ou=Groups,ou=CN,ou=Centralized,dc=automotive,dc=ald,dc=socgen"
获取组成员:
Get-ADGroupMember -identity "GROUPNAME" -Recursive | Get-ADUser -Property DisplayName | Select Name,ObjectClass,DisplayName,SamAccountName,mail
常用属性:
SamAccountName登录名
Displayname显示名称 …
more ...