PowerShellComponent - Execute CommandLine


I need add some logic in the designer process  to trigger the following PowerShell commands,(there is already step to enable) but need to pass the userid/password as below to the QAS command.


Can anyone help how to pass the parameters..




  • Hi Padma,

    Here's an example of a PoSh script (defined as the Script parameter of the PowerShellComponent):

    Dim script As New StringBuilder()
    script.AppendLine( _
    String.Format( _
    "$$cred = New-Object System.Management.Automation.PSCredential (""{0}"", (ConvertTo-SecureString ""{1}""
    –AsPlainText -Force))", _
    $FK(UID_ADSContainer).FK(Ident_Domain).LDAPLogin$, _
    script.AppendLine( _
    String.Format( _
    "$$session = New-PSSession -Configurationname Microsoft.Exchange –ConnectionUri http://{0}/PowerShell -
    Credential $$cred -Authentication Kerberos", _
    script.AppendLine("Import-PsSession $$session")
    script.AppendLine("Import-Module activedirectory")
    script.AppendLine(String.Format("$$user2Find = ""{0}""", $SAMAccountName$))
    script.AppendLine("$$user = Get-ADUser $$user2Find -Properties mail")
    script.AppendLine("Remove-PSSession $$session")
    Value = script.ToString()

    You can see that the commands are using String.Format to replace values in the strings with parameter values that happen to be accessible in the context of the run - it's running against the table ADSAccount.

    Since the parameters do not allow/support additional parameters I would be inclined to use the 'Pre-script for generating' and in there create some 'parameters' as follows:

    values("param1") = <something>
    values("param2") = <something>

    Then in your Script parameter you can use these parameters by referencing:


    Hope that helps,

  • Barry - where are you writing that script on a typical process bubble? I don't see where I can place that script information.
  • Hi James,

    In the job step:

    In the 'Parameters' tab:


    Edit the 'Script' parameter:

    HTH, Barry.

  • Thank you very much
    what we are running into at this point is the import-module QuestAuthenticationServices its being ignored... it doesn't error, but when running a job it says invalid module enable-qasunixuser which indicates its not accepting or finding the module.
    thoughts on what to do with external modules needing to be loaded from within OneIM powershell?
  • The first debug step would be to use the simulation-mode of the process editor in Designer and check your generated PowerShell script in PowerShell to see if it works there.