如何在线连接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/ and https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/xrm-tooling/use-powershell-cmdlets-xrm-tooling-connect
我正在编写一个 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/ and https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/xrm-tooling/use-powershell-cmdlets-xrm-tooling-connect