powershell - 用 Ldap 过滤器替换 Get-ADUser 以摆脱 RSAT 模块
问题描述
我想get-aduser -identity $env:username -properties passwordlastset
用 ldap 过滤器替换这一行。我只需要实际 PC 用户的 Aduser 信息和上次更改密码的日期。
解决方案
$searcher.Filter="(&(samaccountname= $env:username))"
$results=$searcher.findone()
$b = [datetime]::fromfiletime($results.properties.pwdlastset[0])
我自己修好了,这对我有用
推荐阅读
- android - 如何准备要发布的 Jetpack compose 应用程序,@Preview 可组合项呢?
- python - 为什么我的 UpTimeRobot 监视器不工作?它说有一个连接超时
- arrays - 如何根据属性附加一个唯一的结构数组?
- php - Laravel Nova Image Collection 上传“图像集合必须是图像”
- excel - Excel VBA 被过滤不能在图表中工作
- python - 在数组列表中插入一个数组
- regex - 正则表达式找到 2 个字符串之间少于 5 个单词的模式
- html - 图像居中时图像后没有空格
- r - 如何使用 R 构建不同广义线性模型的平均偏效应的漂亮表格?
- android - 如何将 Android Studio 模拟器恢复到早期版本?