Powershell - 如何查询传真号码 [英] Powershell - How to query Fax numbers

查看:139
本文介绍了Powershell - 如何查询传真号码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一名有脚本和初学者的初学者。

I am a beginner with scripting and am jus learning.

我正在考虑编写一个可以接受传真号码作为输入的脚本,并为我提供传真号码分配给的用户列表。

I am looking at composing a script that can accept fax numbers as input and provide me a list of users that the fax number is assigned to.

到目前为止,我已经提出以下建议:

So far, I have comeup with the below:

$ faxnumbers = import-csv c:\ temp \ test.csv 

foreach($ faxnumber in $ faxnumbers)

{

Get-user -resultsize unlimited -Filter" Otherfax -eq'$($ _。Number )'" | FT名称*

}



然而,我收到错误"搜索过滤器无效。"



感谢有关如何在输入文件中提取过滤器中的Faxnumber的任何帮助将是非常有帮助!

$faxnumbers = import-csv c:\temp\test.csv 
foreach ($faxnumber in $faxnumbers)
{
Get-user -resultsize unlimited -Filter "Otherfax -eq '$($_.Number)'"| FT name*
}

However, I get an error " The search filter is invalid."

Appreciate any help on how I can provide the Faxnumber within the filter to be pulled from the input file will be of great help!

推荐答案

AD属性名为OtherFacsimileTelephoneNumber,您使用的是foreach但不使用循环中的变量名称。其中任何一个都应该有效 -  

The AD attribute is called OtherFacsimileTelephoneNumber and you're using a foreach but not using the variable name in the loop. Either of these should work - 

import-csv c:\temp\test.csv | % {

Get-aduser -Filter "OtherFacsimileTelephoneNumber -eq '



_。Number)'" ;
}
_.Number)'" }


这篇关于Powershell - 如何查询传真号码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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