PowerShell Custom Activity

Hello,

i am new to password manager and are looking on an how to remove a user from a group during a workflow.

But how to know about the user that is currently running the workflow so that i can use, for example, the samaccountname for my script?

I tried the following but getting an error message in the log.

$username = $Request["Username"]

remove-adgroupmember "groupname" -member $username -confirm:$false

It seems to be, that the varialbe $username is empty.

Thanks

Frank

Parents
  • I'm having the same trouble as Frank. I'm just trying to test using the custom web services in 5.9.3. I've cut and pasted the examples from out of the SDK and I'm not able to get username or domain. 

    I've tried:

    $userName = $Request.QueryString["user"]

    $userName = $Request.QueryString["UserName"]

    $userName = $Request.Query["UserName"]

    $userName is always $null

    Same for "domain"

    I have gotten the following code to work when I set $username and $domain to static values:

    $username = "myActualUsername"
    $domain = "myActualDomain"
    $connection = $global.GetDirectoryConnectionByName($domain)

    $user = $global.GetUserByName($connection, $username, [string[]]("objectGUID", "mail"))

    if ($user -eq $null) {
    throw "User $username not found in the domain $domain."
    }

    $mail = $user[“mail”]
    $Response.Write(“User $username has the following email address: $mail”)

    This brings up my email, so I know it's working.

    I just can't seem to pull anything out with $Request.Query or $Request.QueryString

    I blindly tried this as well with no luck:

    $workflow.UserInfo.AccountInfo.SamAccountName

Reply
  • I'm having the same trouble as Frank. I'm just trying to test using the custom web services in 5.9.3. I've cut and pasted the examples from out of the SDK and I'm not able to get username or domain. 

    I've tried:

    $userName = $Request.QueryString["user"]

    $userName = $Request.QueryString["UserName"]

    $userName = $Request.Query["UserName"]

    $userName is always $null

    Same for "domain"

    I have gotten the following code to work when I set $username and $domain to static values:

    $username = "myActualUsername"
    $domain = "myActualDomain"
    $connection = $global.GetDirectoryConnectionByName($domain)

    $user = $global.GetUserByName($connection, $username, [string[]]("objectGUID", "mail"))

    if ($user -eq $null) {
    throw "User $username not found in the domain $domain."
    }

    $mail = $user[“mail”]
    $Response.Write(“User $username has the following email address: $mail”)

    This brings up my email, so I know it's working.

    I just can't seem to pull anything out with $Request.Query or $Request.QueryString

    I blindly tried this as well with no luck:

    $workflow.UserInfo.AccountInfo.SamAccountName

Children
No Data