Public/Invoke-GetADUser.ps1
function Invoke-GetADUser { <# .SYNOPSIS Gets information about an Active Directory user .PARAMETER UserName Target user .EXAMPLE !User dk.test.hz #> [PoshBot.BotCommand( CommandName = 'User', Aliases = ('ADUser', 'who', 'search'), Permissions = 'invoke' )] [cmdletbinding()] param( [parameter(Mandatory)] [string]$username ) Import-Module ActiveDirectory $searchname = '*' + $username + '*' $GCADUser = Get-ADUser -Filter { (((SamAccountName -like $searchname) -or (Name -like $searchname)) -and ((Enabled -eq $true) -and (mail -like "*"))) } -Server sundc1:3268 -Properties * | Select-Object Name, UserPrincipalName, mail, telephonenumber, mobile, department New-PoshBotCardResponse -Text ($GCADUser | format-list -property * | out-string) } |