So today I received an email from a customer who was wanting to know a fast way to change a user's PIN in AuthAnvil. Of course, the easiest way is to have the user visit the AuthAnvil Self Service Portal on your server (https://servername/ManageToken/) and click the "Change PIN" link.
Another way is to log into the AuthAnvil Manager and manually change it for the user. But I have another way you can do it, if you are a cmd line kind of guy like me.
Simply write a PowerShell script to do it!! Or better yet, let me do that for you. Here is what I whipped up in about 2 minutes...
# ************************************************************** # # Sample script to change a user's PIN # # Author: Dana Epp (dana@scorpionsoft.com) # # ************************************************************** . $pwd\LoadAuthAnvilLibraries.ps1 function Usage() { Write-Host " ChangePIN <admin_username> <passcode> <SiteID> <username> <NEWPIN>" } if( $args.Length -ne 5 ) { Write-Host "Invalid arguments. Usage:" Usage; return; } CLS $ADMSVC = LoadAuthAnvilAdmin( "https://servername/AuthAnvilAdmin/Admin.asmx" ) $SESSIONKEY = $ADMSVC.Logon( $args[0], $args[1], 1, $args[2] ) if( $SESSIONKEY -eq $null ) { Write-Host "Failed to generate admin session key. Aborting!" return } $RETCODE = $ADMSVC.UpdatePIN( $SESSIONKEY, $args[3], $args[4], $args[2] ) if( $RETCODE -ne "True" ) { Write-Host "Failed to change PIN!" return } Write-Host "PIN changed."
# **************************************************************
There you have it. Simply replace "servername" with the FQDN of your AuthAnvil server and you are done.
If you have PowerShell installed and have the AuthAnvil Admin PowerPack, you can easily write your own administrative functions to do this sort of thing. If you haven't had a chance, you might want to check out our webinar we did on the subject in the Educaiton and Training section of the Customer Portal. There is tons of information on how best to use our Web Services API to extend your admin functionality to our platform.
Hope it helps. If you would like to see other sample PowerShell scripts, feel free to let us know.
Comments