powershell - 在 Exchange Server 2010 上创建/导入新联系人时出错 [PowerShell]
问题描述
我有我使用的这个脚本,它过去工作得很好,用于创建联系人,我在 Exchange 服务器的 Powershell 控制台中运行这个脚本。
# This script creates contacts from csv file
#Set-ExecutionPolicy Unrestricted
Import-Module ActiveDirectory
Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010;
.'C:\Program Files\Microsoft\Exchange Server\V14\bin\RemoteExchange.ps1'
clsconnect-ExchangeServer -server1
Import-Csv "C:\contacts.csv" | foreach {
%{New-MailContact -Name $_.Name -DisplayName $_.Name -ExternalEmailAddress $_.ExternalEmailAddress -FirstName $_.FirstName -LastName $_.LastName -OrganizationalUnit $_.OU }
}
现在,当我运行脚本时,我遇到以下错误:
New-MailContact : The term 'New-MailContact' is not recognized as the name of a cmdlet, function, script file, or
operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try
again.
At line:4 char:3
+ %{New-MailContact -Name $_.Name -DisplayName $_.Name -ExternalEmailAd ...
+ ~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (New-MailContact:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
我仔细检查了 csv,它看起来没问题。
会出什么问题?
谢谢。
解决方案
推荐阅读
- python - NumPy 中数组的形状
- reactjs - 无法访问函数中的道具
- json - ansible, jinja2, json - 在 Jinja 中使用 json_query?
- python - Animating a curve in Maya with Python
- javascript - 在全局范围内查找具有特定方法的 javascript 对象
- c# - C#、N 层、MVC | 错误:“对象引用未设置为对象的实例。”
- wiremock - 来自键=值对的wiremock请求匹配
- python - 如何在执行另一个命令时打破 discord.py 命令中的循环?
- java - MapStruct:如何映射到现有目标?
- python - 在循环中创建 df 表单列表理解