I'm automating some tasks in Dynamics CRM using a simple Windows Forms app, but when I connect to the CRM system the Initialization step of the command just hangs, per the attached. This works at the command line - anyone know what is going on?
$cred = Get-Credential -Message 'Please enter your email address and CRM password'
$conn = Get-CrmConnection -serverurl <CRM URL> -OrganizationName AmadeusCapital -Credential $cred
XRM Tooling connection from GUI
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
-
- Posts: 6
- Last visit: Thu Oct 05, 2023 8:13 am
XRM Tooling connection from GUI
- Attachments
-
- ScriptDriver64_CvvD70sdRF.png (2.77 KiB) Viewed 643 times
Re: XRM Tooling connection from GUI
This is an issue with many service type connections from WinForms in PowerShell. The thread that executes the form is blocked so the connection attempt will hang. Try making the connection before you call the form. In most cases this works. I have not used the CRM module so I can't say if this module has the same behavior. It likely does as MS has focused for the last few years on creating a common connection API at least for cloud services.
You may be able to create a global connection for the Windows session so all programs will be pre-authenticated. This likely will require MFA.
Use a WinForms project and connect in "startup.pss" in the "Main" function before the form is called.
You may be able to create a global connection for the Windows session so all programs will be pre-authenticated. This likely will require MFA.
Use a WinForms project and connect in "startup.pss" in the "Main" function before the form is called.
-
- Posts: 6
- Last visit: Thu Oct 05, 2023 8:13 am
Re: XRM Tooling connection from GUI
Thanks - that worked. Had to re-arrange the code as it was just a script, but all working now.