none
Calling FIMAutomation cmdlets from ASP.NET web application RRS feed

  • Question

  • I'm trying to programmatically register a user for SSPR from an ASP.NET web application using the sample code found here:

    http://technet.microsoft.com/en-us/library/jj134294(v=ws.10).aspx

    However, invoking the cmdlet Get-AuthenticationWorkflowRegistrationTemplate is throwing the following exception:

    exePath must be specified when not running inside a stand alone exe

    Has anybody else seen this, or is there a better way to register a user for SSPR from an ASP.NET web application? I've looked at using the FIM client on codeplex, but the QA gate data seems to be a binary format, and I'm not sure how it should be specified.

    Cheers,
    Mark

    Wednesday, February 27, 2013 1:32 PM

Answers

  • It is possible to write a .NET application to register users with Powershell cmdlets directly as normal .NET objects without generating any intermediate Powershell script as in the Technet example.  I've done this and it works well, and is a more robust solution; e.g., the Technet example is vulnerable to script injection.

    Steve Kradel, Zetetic LLC SMS OTP for FIM | Salesforce MA for FIM

    Monday, March 4, 2013 9:38 PM

All replies

  • Well ... from ASP .NET better idea might be actually to use resources client from Codeplex - but for the main question I don't have answer to be honest as I have not tried it yet.

    Tomek Onyszko, memberOf Predica FIM Team (http://www.predica.pl), IdAM knowledge provider @ http://blog.predica.pl

    Wednesday, February 27, 2013 7:48 PM
  • Tomasz,

    Have you used the FIM client from Codeplex to register a user for SSPR? I've investigated this option but it didn't seem clear as to how it may be accomplished and the samples only demonstrate how to reset a user's password using the client.

    If you have been able to do this, any assistance in explaining how it is done would be greatly appreciated.

    Cheers,
    Mark

    Monday, March 4, 2013 2:31 PM
  • It is possible to write a .NET application to register users with Powershell cmdlets directly as normal .NET objects without generating any intermediate Powershell script as in the Technet example.  I've done this and it works well, and is a more robust solution; e.g., the Technet example is vulnerable to script injection.

    Steve Kradel, Zetetic LLC SMS OTP for FIM | Salesforce MA for FIM

    Monday, March 4, 2013 9:38 PM
  • Thanks Steve! That did the trick!

    I'm still new to PowerShell and cmdlets, so it didn't even occur to me that I could just use the cmdlets as normal .NET objects, but it makes perfect sense when you step back and think about it.

    Cheers,
    Mark

    Thursday, March 7, 2013 2:49 PM
  • I just fixed it by setting those two line before opening the runspace in c#

    runspace.ApartmentState = System.Threading.ApartmentState.STA;
    runspace.ThreadOptions = System.Management.Automation.Runspaces.PSThreadOptions.UseCurrentThread;

    After that I had to pass the "credential" property to the cmdlet.

    Friday, March 7, 2014 10:25 AM