none
QIK CLI - Not passing the parameter value RRS feed

  • Question

  • Hi,

    I'm trying to create a IP using QIK cli with following parameters. However the script doesnt seem to get the values that are configured on the properties of the object.

    PARAM (
            [String] $DC = $null,
            [string] $userID = $null,
            [string] $passwd = $null,
            [String] $OUName = $null,
            [String] $Acc = $null
        )

    $Domain = $DC
    $Useraccount = $UserID
    $UsrPass = $passwd
    $OUDN = $OUName
    $Account = $AccountID
    $Pass = ConvertTo-SecureString $UsrPass -AsPlainText -Force
    $Cred = New-Object -Typename System.Management.Automation.PSCredential -Argumentlist $Useraccount,$Pass

    This is what I have for the QIK CLI command line.

    . RemoveAuthUsers.ps1;RemoveAuthUsers -DC '$(DomainController)' -UserID '$(Username)' -Passwd '$(Password)' -OUName '$(OU)' -Acc '$(Account)'

    When I test the IP, I get this error,

    Cannot bind argument to parameter 'String' because it is an empty string

    Any idea what I'm doing wrong here?

    Thanks

     

     

    Monday, June 6, 2011 1:58 AM

Answers

  • The fact that the script is returning an error that parameters are missing tells me that either (a) you are running the activity without putting any values in the property fields, or (b) the command line you provided is not providing the parameters properly.

    So I see your QIK command line there, but do you actually have the parameters in the "Parameters" list below that command line, and they show up as property fields when you run the command via the Invoke .NET Object?

     

     




    Robert Hearn • Sr. Program Manager
    Opalis / System Center Orchestrator

    Tuesday, June 28, 2011 3:46 PM

All replies

  • The fact that it's calling your parameter name 'String' tells me that there's an error in your PARAM section.

    Are you sure the PARAM section above is exactly like it is in your script?

    Also, since you're not checking the value of the incoming parameters and automatically assigning null, it's hard to tell which parameter might be the problem. It would be better to do this if every parameter is mandatory:

    [CmdletBinding()]

    PARAM (

            [Parameter(Mandatory=$true)]
            [String] $DC,

            [Parameter(Mandatory=$true)]
            [String] $userID, 

            [Parameter(Mandatory=$true)]
            [String] $passwd,

            [Parameter(Mandatory=$true)]
            [String] $OUName,

            [Parameter(Mandatory=$true)]
            [String] $Acc

    )

     




    Robert Hearn • Sr. Program Manager
    Opalis / System Center Orchestrator


    Monday, June 6, 2011 3:27 PM
  • Thanks for replying. this is the error that I get with the modifications that you suggested.

    Cannot process command because of one or more missing mandatory parameters: DC userID passwd OUName AccountID.

    Here's the whole script.

    [CmdletBinding()]
    PARAM (
     
     [Parameter(Mandatory=$true)]
     [String] $DC,
     
     [Parameter(Mandatory=$true)]
            [String] $userID,

     [Parameter(Mandatory=$true)]
            [String] $passwd,

     [Parameter(Mandatory=$true)]
            [String] $OUName,
     
     [Parameter(Mandatory=$true)]
            [String] $AccountID

    )

    $Domain = $DC
    $Useraccount = $UserID
    $UsrPass = $passwd
    $OUDN = $OUName
    $Account = $AccountID
    Add-PSSnapin Quest.ActiveRoles.ADManagement
    $Pass = ConvertTo-SecureString $UsrPass -AsPlainText -Force
    $Cred = New-Object -Typename System.Management.Automation.PSCredential -Argumentlist $Useraccount,$Pass
    Connect-QADService -Service $Domain -Credential $Cred
    Get-QADPermission -identity $OUDN -ApplyTo 'ThisObjectOnly' |Where-Object {$_.account -match $Account} | Remove-QADPermission

     

    Also I have this in the opalis QIK command line.

    RemoveAuthUsers.ps1;RemoveAuthUsers -DC '$(DomainController)' -userID '$(Username)' -passwd '$(Password)' -OUName '$(OU)' -AccountID '$(Acc)'

    this script work from a powershell or when running using command line powershell -file  .....

    I'm clueless what is going wrong with this.

     

    Monday, June 6, 2011 6:38 PM
  • The fact that the script is returning an error that parameters are missing tells me that either (a) you are running the activity without putting any values in the property fields, or (b) the command line you provided is not providing the parameters properly.

    So I see your QIK command line there, but do you actually have the parameters in the "Parameters" list below that command line, and they show up as property fields when you run the command via the Invoke .NET Object?

     

     




    Robert Hearn • Sr. Program Manager
    Opalis / System Center Orchestrator

    Tuesday, June 28, 2011 3:46 PM