Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Any success using new-webserviceproxy with CRM in PowerShell?

$
0
0

Has anyone successfully used New-WebServiceProxy with the Crm service in Powershell?

I can load the wsdl stream and compile it into an assembly loaded into memory, similiar to what is shown here, but that has a long startup time. Powershell 2 introduces new-webserviceproxy and I was hoping to use that with CRM but haven't had any success.

$Crm = New-WebServiceProxy -URI http://CrmServer/MSCRMServices/2007/CrmService.asmx -Class CrmService -UseDefaultCredential

New-WebServiceProxy : Could not load file or assembly 'file:///d:\temp\2mkiomxi.dll' or one of its dependencies. The system cannot find the file specified.
At D:\CRM\CrmUserSync\test.ps1:2 char:27
+ $Crm = New-WebServiceProxy <<<<  -URI http://CrmServer/MSCRMServices/2007/CrmService.asmx -Class CrmService -UseDefaultCredential
    + CategoryInfo          : NotSpecified: (:) [New-WebServiceProxy], FileNotFoundException
    + FullyQualifiedErrorId : System.IO.FileNotFoundException,Microsoft.PowerShell.Commands.NewWebServiceProxy

The temp file location is determined by the TMP environmental variable. The error doesn't occur if I omit the class type but if I do that I won't get a usable class. I tried using -namespace and specifying the namespace of CrmService but that didn't matter. This is for CRM 4.0 but CRM 2011 using the CRM 4.0 web service would be the same.

Due to changing customizations I don't want to compile a dll ahead of time and load it. Compiling on the fly takes about 20 seconds and I can't cache the assembly if the user isn't running the script from the powershell command line.


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>