首页 > 解决方案 > 用 Ldap 过滤器替换 Get-ADUser 以摆脱 RSAT 模块

问题描述

我想get-aduser -identity $env:username -properties passwordlastset用 ldap 过滤器替换这一行。我只需要实际 PC 用户的 Aduser 信息和上次更改密码的日期。

标签: powershellfilterldap

解决方案


$searcher.Filter="(&(samaccountname= $env:username))"
$results=$searcher.findone()
$b = [datetime]::fromfiletime($results.properties.pwdlastset[0]) 

我自己修好了,这对我有用


推荐阅读