利用Powershell查询AD中电脑
Get-ADComputer -Filter *
利用Powershell查询AD中电脑详细信息
Get-ADComputer -Filter * -Property *
查询用户详细信息
Get-ADUser-Identity"User1"-Properties*
将用户"User1"的部门修改为"开发部",并启用该用户:
Get-ADUser-Identity"User1" | Set-ADUser-Department"Develop"-Enabled$true
查询禁用的用户
Search-ADAccount-AccountDisabled–UsersOnly
禁用、启用用户:
Disable-ADAccount-Identity"User1"
Enable-ADAccount-Identity"User1"
查询登录并锁定的用户
Search-ADAccount–LockedOut
(一) 筛选AD中被停用的用户
Search-ADAccount –AccountDisabled
Search-ADAccount –AccountDisabled>c:\name.txt
筛选AD中被停用的计算机账号,然后统一移动到discomputer组织单位中
Search-ADAccount -AccountDisabled -ComputersOnly | Move-ADObject -TargetPath "OU=discomputer,OU=IT
,DC=contoso,DC=Com"
使用下面命令可以查询某个OU下面已经禁用的计算机账号
Search-ADAccount -AccountDisabled -Searchbase "OU=IT,DC=Contoso,DC=Com"
-ComputersOnly
其他AD Powershell计算机、账户、组管理常用命令参考
本文出自 “微软笔记” 博客,请务必保留此出处http://lishengxian.blog.51cto.com/9081663/1737324
原文:http://lishengxian.blog.51cto.com/9081663/1737324