This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ManuallyForcedToUpdateQAProfile

Hello,

Can someone tell me how to use this in a PowerShell Custom workflow?

I have all i need to send a random passcode from the SDK example although I don't know how to force them in this workflow to update Q&A profile.

Here is my code all works but the force Q&A profile.

________________________________________________________

function PostExecuting($workflow, $activity)
{
#Passcode length
$PASSCODE_LENGTH = 12

#Passcode lifetime in minutes
$PASSCODE_LIFETIME = 1440 #(1 day)

#Parse request parameters - domain and user name
$domain = "domain.com"
$connection = $global.GetDirectoryConnectionByName($domain)
$userId = $Workflow.UserInfo.AccountInfo.objectGUID
$firstname = $Workflow.UserInfo.AccountInfo.givenname
$lastname = $Workflow.UserInfo.AccountInfo.sn


#Generate a passcode for a user
$PASSCODE= $global.GeneratePasscode($PASSCODE_LENGTH)

#Assign passcode to a user
$global.QAProfileAssignPasscode($connection, $userId, $passcode, $PASSCODE_LIFETIME)

#replace items in HTML file
$html = Get-Content "E:\Email\PasscodeEXT3.html"
$html = $html -replace "~passcode", $passcode
$html = $html -replace "~firstname", $firstname
$html = $html -replace "~lastname", $lastname


# generate email information
$subject = "Random Passcode generated"
$email = $Workflow.UserInfo.AccountInfo.mail

$global.EmailUserHtml($email, $subject, $html)

$Workflow.UserInfo.ManuallyForcedToUpdateQAProfile($true)
}

Parents
  • I found the following documentation on this method in the Password Manager source code:

    public bool ManuallyForcedToUpdateQAProfile { get; set; }

    Gets or sets a value indicating whether a user was forced to update the Q&A profile by a helpdesk operator. True if the user was forced to update Q&A profile by the helpdesk operator; otherwise, false.

    So it looks like this method doesn't do what you want it to do.

    I believe that you should be using the ForcedToUpdateQAProfile method. This method accepts a timestamp in DateTime format. Just set a time in the past, or grab today's date, and that should force the user to update their Q&A profile if they connect after that date.

  • Terrance,

    Thanks for the information. Here is my final code that i got to work.

    Tahnk you,

    Lu

    function PostExecuting($workflow, $activity) 
    {
    #Passcode length
    $PASSCODE_LENGTH = 12

    #Passcode lifetime in minutes
    $PASSCODE_LIFETIME = 1440 #(1 day)

    #Parse request parameters - domain and user name
    $domain = "domain.com"
    $connection = $global.GetDirectoryConnectionByName($domain)
    $userId = $Workflow.UserInfo.AccountInfo.objectGUID
    $firstname = $Workflow.UserInfo.AccountInfo.givenname
    $lastname = $Workflow.UserInfo.AccountInfo.sn


    #Generate a passcode for a user
    $PASSCODE= $global.GeneratePasscode($PASSCODE_LENGTH)

    #Assign passcode to a user
    $global.QAProfileAssignPasscode($connection, $userId, $passcode, $PASSCODE_LIFETIME)

    #replace items in HTML file
    $html = Get-Content "E:\Email\PasscodeEXT3.html"
    $html = $html -replace "~passcode", $passcode
    $html = $html -replace "~firstname", $firstname
    $html = $html -replace "~lastname", $lastname


    # generate email information
    $subject = "Random Passcode generated"
    $email = $Workflow.UserInfo.AccountInfo.mail

    $global.EmailUserHtml($email, $subject, $html)

    # force update to Q&A profile
    $Global.QAProfileSetForceEnrollStartDate($connection, $userId, $today)
    }

Reply
  • Terrance,

    Thanks for the information. Here is my final code that i got to work.

    Tahnk you,

    Lu

    function PostExecuting($workflow, $activity) 
    {
    #Passcode length
    $PASSCODE_LENGTH = 12

    #Passcode lifetime in minutes
    $PASSCODE_LIFETIME = 1440 #(1 day)

    #Parse request parameters - domain and user name
    $domain = "domain.com"
    $connection = $global.GetDirectoryConnectionByName($domain)
    $userId = $Workflow.UserInfo.AccountInfo.objectGUID
    $firstname = $Workflow.UserInfo.AccountInfo.givenname
    $lastname = $Workflow.UserInfo.AccountInfo.sn


    #Generate a passcode for a user
    $PASSCODE= $global.GeneratePasscode($PASSCODE_LENGTH)

    #Assign passcode to a user
    $global.QAProfileAssignPasscode($connection, $userId, $passcode, $PASSCODE_LIFETIME)

    #replace items in HTML file
    $html = Get-Content "E:\Email\PasscodeEXT3.html"
    $html = $html -replace "~passcode", $passcode
    $html = $html -replace "~firstname", $firstname
    $html = $html -replace "~lastname", $lastname


    # generate email information
    $subject = "Random Passcode generated"
    $email = $Workflow.UserInfo.AccountInfo.mail

    $global.EmailUserHtml($email, $subject, $html)

    # force update to Q&A profile
    $Global.QAProfileSetForceEnrollStartDate($connection, $userId, $today)
    }

Children
No Data