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') )] [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-PoshBotTextResponse -Text ($GCADUser | Out-String) -AsCode } |