PowerShell的用户搜索卫生组织帐户到期的办公信息卫生组织、帐户、用户、信息

2023-09-08 13:10:50 作者:不美不萌不淑女°

谁能告诉我如何使用PowerShell来检索广告infor关于用户提供从办公领域的信息卫生组织帐户到期。

Can anyone tell me how to use powershell to retrieve AD infor about users whos account expires with the info from the Office field.

像这个名称,办公,EXPIREDATE

Like this Name, Office, Expiredate

和如何将它从useraccount发送服务器上登录。

And how to send it from the useraccount logged in on the server.

BTW:QADuser是不是一种选择

BTW: QADuser is not an option.

推荐答案

试试这个:

foreach ($user in (gwmi -namespace "root/directory/ldap" -class "ds_user"))
{
    write " `
        $user.DS_name, `
        $user.DS_physicalDeliveryOfficeName,
        (w32tm /ntte $user.DS_accountExpires) `
        " `
    | Out-File ".\userlist.txt" -Append -Encoding ASCII;
}
 
精彩推荐