繁体   English   中英

如何在线连接 PowerShell 与 CRM?

[英]How to connect PowerShell with CRM online?

我正在编写一个 PowerShell 脚本,它需要在线连接到 CRM。

我可以使用Connect-CrmOnline连接到 CRM,它使用登录框要求提供凭据。 我想自动化它。 请指导如何做。

有没有办法使用连接字符串进行连接? 请分享示例代码/脚本。 我是 PowerShell 的新手。

我正在使用Microsoft.Xrm.Data.PowerShell

谢谢你。

您可以构建凭证对象并在脚本中使用它。 例如:

$secpasswd = ConvertTo-SecureString "PlainTextPassword" -AsPlainText -Force
$mycreds = New-Object System.Management.Automation.PSCredential ("username", $secpasswd)

然后,您可以在脚本中使用-credential $mycreds参数使用它

参考: https : //blogs.msdn.microsoft.com/koteshb/2010/02/12/powershell-how-to-create-a-pscredential-object/https://docs.microsoft.com/en-us /dynamics365/customer-engagement/developer/xrm-tooling/use-powershell-cmdlets-xrm-tooling-connect

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM