AuthLite version 1.0.6 and later registers a PowerShell provider interface (snap-in) for accessing the AuthLite data store of the local machine.
By default, this snap-in will not be loaded into your shell. To enable AuthLite PowerShell integration, you should run the following commands from inside PS:
Add-PSSnapin AuthLiteProvider
# Note this requirement will be changed in the future
# once Collective begins signing our ps1 scripts
Set-ExecutionPolicy Unrestricted
if("$Env:ProgramW6432" -ne "")
{
Update-FormatData -PrependPath "$Env:ProgramW6432\Collective Software\AuthLite\AuthLiteProvider.format.ps1xml"
}
else
{
Update-FormatData -PrependPath "$Env:ProgramFiles\Collective Software\AuthLite\AuthLiteProvider.format.ps1xml"
}
These commands load the snap-in and default data formatting cues for AuthLite data access. You would normally place these commands into a PS profile.
Obtain a recursive list of information in the data store:
ls -r AUTHLITE:\
Go to the Keys directory (assuming your domain name is 'Sandbox'), and then obtain a list of every username that is set up with an AuthLite key. The use of ToLower, Sort-Object, and Get-Unique here ensures that you see each username only once, even if there is more than one key associated to that user.
cd AUTHLITE:\Sandbox\Keys
ls | ForEach-Object{$_.Username.tolower()}|Sort-object|get-unique
Print out the license key to the console, using variable interpolation. Again, assuming the domain name is Sandbox:
Write-Host "The value of the license key is: ${AUTHLITE:\Sandbox\Settings\License\Value}."
At the time of this article's writing, the provider is read-only, i.e. there is no way to add, change, or remove data from the store via this provider. This functionality is planned for a future release!