一些获取AD中用户信息的powershell名, 非常实用。
来源:互联网 发布:java二叉树递归高度 编辑:程序博客网 时间:2024/06/11 09:14
# Search for all users in the domain, using PowerShell v1 syntax
$Searcher = New-Object DirectoryServices.DirectorySearcher
$Searcher.Filter = '(objectcategory=user)'
$Searcher.FindAll().Count
# Search for all users in the domain using [adsisearcher] type accelerator, PowerShell v2 syntax
([adsisearcher]'(objectcategory=user)').FindAll().Count
# Search for administrator and display its properties
([adsisearcher]'(samaccountname=administrator)').FindOne()
([adsisearcher]'(samaccountname=administrator)').FindOne().properties
# Display pwdlastset parameter of Administrator
$ADSIAdmin = ([adsisearcher]'(samaccountname=administrator)').FindOne()
$ADSIAdmin.properties.pwdlastset
# [adsisearcher] always returns arrays, to retrieve the correct data index into the array
$ADSIAdmin.properties.pwdlastset.GetType()
$ADSIAdmin.properties.pwdlastset[0].GetType()
# Use the DateTime .NET Class to convert the FileTime to a DateTime object
[DateTime]::FromFileTime($ADSIAdmin.properties.pwdlastset[0])
# Search for a computer account, samaccountname includes dollar sign
([adsisearcher]'(samaccountname=jbdc01)').FindOne()
([adsisearcher]'(samaccountname=jbdc01$)').FindOne()
# Search for all users that do not have homedirectory attribute set
([adsisearcher]'(!homedirectory=*)').FindAll()
([adsisearcher]'(&(objectcategory=user)(!homedirectory=*))').FindAll()
([adsisearcher]'(&(objectcategory=user)(!homedirectory=*))').FindAll().Count
其他的可以参考以下网址:
http://www.jaapbrasser.com/wp-content/uploads/2012/11/Adsisearcher-Examples.txt
- 一些获取AD中用户信息的powershell名, 非常实用。
- (证实可用)C#获取AD所有的用户信息,比如登录名,邮件名,属于组织,名字
- C#获取AD用户信息
- C#获取AD用户信息
- C# 获取AD用户信息
- C#获取AD用户信息
- C#获取AD用户信息
- PowerShell导出AD安全组用户信息
- SharePoint站点中用户信息与AD用户信息的“不一致”问题
- 如何用powershell导出AD用户信息到CSV中并发送到本地邮箱中
- java获取AD域用户信息
- java获取AD域用户信息
- 从AD中获取SharePoint用户的登录名和显示名的方法
- C# 访问AD中用户信息的几个操作
- 在C#中访问AD用户信息的示例操作
- 【QTP】一些非常实用的判断函数
- 一些非常实用的 Android 开发资源
- 一些非常实用的 Android 开发资源
- hadoop fs –stat命令详解
- 转:我学编程时犯的最大两个错误
- EMV技术学习和研究(九)终端行为分析
- hadoop fsck 命令详解
- C# get set
- 一些获取AD中用户信息的powershell名, 非常实用。
- Quick Sort 快速排序
- Highcharts web图形控件:纯JAVASCRIPT
- Activity的四种launchMode
- 插入排序(Insertion Sort)
- Hand Crafted 特征 PK 纯学习的特征提取方法
- Eclipse安装SVN后,快捷键和代码提示的恢复
- 10年跳槽经验总结 高级人才不用找工作
- 归并排序(Merge sort,台湾译作:合并排序)