尝试从Active Directory导出过期用户帐户列表,特别是他们的经理名称 [英] Trying to export a list of expiring user accounts from Active Directory, and specifically their managers' name

查看:107
本文介绍了尝试从Active Directory导出过期用户帐户列表,特别是他们的经理名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我没有太多的PS脚本编写经验,但花了一些时间寻找答案。  我可以轻松提取过期的帐户,但我很难将管理器的名称添加到输出中。  非常感谢任何帮助。  
以下是来自脚本的片段:(粗体是我试图找到正确语法的地方)

I don't have much PS scripting experience, but have spent some time searching for an answer.  I can easily extract the expiring accounts, but am struggling with adding the name of the manager to the output.  Any help is greatly appreciated.  Below is a snippet from the script: (the bold is where I am attempting to find the correct syntax)


  • $ adUser = Search -ADAccount -AccountExpiring -TimeSpan 6.00:00:00 |选择对象名称,AccountExpirationDate | Sort-Object AccountExpirationDate
  • $ adUserManager = Get-ADUser * -Properties Manager | Select-Object Name,@ {n =" ManagerName"; e = {(Get-ADUser -Identity $ _。Manager -Properties displayName).DisplayName}}

  • $adUser = Search-ADAccount -AccountExpiring -TimeSpan 6.00:00:00 | Select-Object Name,AccountExpirationDate | Sort-Object AccountExpirationDate
  • $adUserManager = Get-ADUser * -Properties Manager | Select-Object Name, @{n="ManagerName";e={(Get-ADUser -Identity $_.Manager -Properties displayName).DisplayName}}

推荐答案

你会输出这个管道之后。您选择要输出的其他内容的位置,例如名称。我还建议格式化您的代码或至少使用"邮政编码"寻求帮助时的选项。
You would output this after the pipeline. Where you have selected other things to output such as the name. I would also recommend formatting your code or at least using the "post code" option when asking for help.


这篇关于尝试从Active Directory导出过期用户帐户列表,特别是他们的经理名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆