Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

BlackBerry Web Services

Posts: 1
Registered: ‎08-19-2010
My Device: Not Specified

Trying to use PowerShell for provisioning

Hi all,
  I'm attempting to use PowerShell to provision a new user on an Exchange BES running 5.0.1.


  I've translated the C# sample code in the documentation, but I'm stuck on trying to map the result of gatherEnableBlackBerryUserAttributes into the input to createUser.


  As you can see, there seems to be an issue mapping the attribute over due to a naming conflict.  Now I remember seeing somewhere that ideally, you would combine the WSDLs, and perhaps all would be well, but I'm not quite sure how to do this in PowerShell.


PS C:\> $BesNewUser.userEnableBlackBerryAttributes.enableBlackBerryUserAttributes[0] = $BesUserResp.enableBlackBerryUserAttributes[0]


Array assignment to [0] failed: Cannot convert the "MgdBesExchange.EnableBlackBerryUserEmailAttributes" value of type "
MgdBesExchange.EnableBlackBerryUserEmailAttributes" to type "MgdBesCore.EnableBlackBerryUserAttributesType"..
At line:1 char:75
+ $BesNewUser.userEnableBlackBerryAttributes.enableBlackBerryUserAttributes[ <<<< 0] = $BesUserResp.enableBlackBerryUse
    + CategoryInfo          : InvalidOperation: (MgdBesExchange....EmailAttributes:EnableBlackBerryUserEmailAttributes
   ) [], RuntimeException
    + FullyQualifiedErrorId : ArrayAssignmentFailed




Any and all advice appreciated.



New Member
Posts: 1
Registered: ‎03-06-2012
My Device: -
My Carrier: -

Re: Trying to use PowerShell for provisioning

Hi all,
I have the same problem with using Powershell.


For example, I try to adapt this simple C# code

findLocales request = new findLocales(); String[] locales = utilWebService.findLocales(request);

 to powershell code:



$BAAServiceUtil=New-WebServiceProxy -Uri "https://basprovlync.eq1tor.local/baaws/core/wsutil?wsdl" -Namespace Wsutil
[wsutil.findlocales]$request=new-object wsutil.findlocales

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     findLocales                              System.Object


Cannot convert argument "0", with value: "Wsutil.findLocales", for "findLocales" to type "Wsutil.findLocales": "Cannot
convert the "Wsutil.findLocales" value of type "Wsutil.findLocales" to type "Wsutil.findLocales"."
At line:1 char:37
+ $locales=$BAAServiceUtil.findLocales <<<< ($req)
    + CategoryInfo          : NotSpecified: (Smiley Happy [], MethodException
    + FullyQualifiedErrorId : MethodArgumentConversionInvalidCastArgument


An idea ?