Get-ADUserBasicInfo
Formatting Basic AD Information in the Output your Want
Get-ADUserBasicInfo Function
by Michael J. Thomas
Here is an example of how you an put together a basic list of information that you want to find out about a user's account.
.Synopsis
Get-ADUserBasicInfo
.DESCRIPTION
Gets the basic information of the user. Including UserName, First Name, Last Name, Email Address,
O365,Exchange DB, Title, Enabled, LockedOut, LastLogonDate, User OU, Notes
.EXAMPLE
Get-ADUserBasicInfo -UserName "PowerShellGuy"
.EXAMPLE
Get-ADUserBasicInfo -UserName "PowerShellGuy","michael.thomas"
#>
function Get-ADUserBasicInfo{
[cmdletbinding()]
Param(
[string[]]$UserName
)
#$ErrorActionPreference= 'silentlycontinue'
Foreach ($User in $Username){
$O365 = If ((Get-AdUser $User -Properties targetAddress).targetAddress -ne $null) {
If ((Get-ADUser $User -Properties targetAddress).targetAddress.Contains(".onmicrosoft.com")){
$true
}
}
Else{
$false
}
$LyncAccount = If ((get-aduser $User -Properties msRTCSIP-PrimaryHomeServer).'msRTCSIP-PrimaryHomeServer' -or `
(get-aduser $User -Properties msRTCSIP-DeploymentLocator).'msRTCSIP-DeploymentLocator'){
$true
}
Else{
$false
}
Get-ADUser -Identity $User -Properties SamAccountName, GivenName, SurName, EmailAddress, Title, Enabled, LockedOut, LastLogonDate, CanonicalName, homeMDB, Name, info, targetAddress | `
Select-Object @{name = 'UserName'; expression = {($_.SamAccountName.ToUpper())}}, `
@{Name = 'First Name'; Expression = {($_.GivenName)}}, `
@{Name = 'Last Name'; Expression = {($_.Surname)}}, `
@{Name = 'Email Address'; Expression = {($_.EmailAddress)}}, `
@{Name = 'O365'; Expression = {($O365)}},`
@{Name = 'Exchange DB'; Expression = { (($_.HomeMDB).split(',')[0]).split('=')[1] } }, `
@{Name = 'Lync Account'; Expression = {($LyncAccount)}},`
Title, Enabled, LockedOut, LastLogonDate, `
@{Name = 'User OU'; Expression = {($_.CanonicalName)}},
@{Name = 'Notes'; Expression = {($_.info)}}
}
}
We have included a listing of all of the top-tier software program provider companions answerable for the creation of our titles. Through utilization of} RNG , an industry-standard system that ensures that all one|that each one} of our titles are completely impartial to players. These algorithms guarantee that your chosen sport will randomise the result and give you honest outcomes. Our web site is using fully integrated HTML5 software program, which implies 1xbet that all our video games will run straight from our platform. Our web site has been specifically designed to vary scale relying on the system you’re viewing it from.
ReplyDelete