Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

Listing User Attributes for Enabled and Disabled Users

$
0
0

Hello.

I am having trouble trying to change the name of attributes for enabled and disabled accounts using Get-QADUser.  For example, I'd like the useraccountcontrol attribute to display, "Enabled" or "Disabled" instead of 512 and 514. Essentially, I am trying to create a GUI which allows the person to select multiple attributes to be displayed in a csv file. Here is my current script without the GUI. Any ideas how I can clean this up and make it more functional? Thanks!

####
$CDays = Read-host "Created more than xx days ago"
#
$LDays = Read-Host "Logon more than xx days ago"
#
$created = (Get-Date).AddDays(-$CDays)
#
$logon = (Get-Date).AddDays(-$LDays)
#
$users = Get-QADUser 'domain\OU' -IncludeAllProperties


@(foreach($user in $users)
{
$user | Select-Object DisplayName,LogonName,description,manager,createTimeStamp,lastLogonTimestamp,userAccountControl | where {$_.lastLogonTimestamp -le $logon} | where {$_.createTimeStamp -le $created}
})| export-Csv "c:\test\report.csv" -noType
#####


Viewing all articles
Browse latest Browse all 8411

Latest Images

Trending Articles



Latest Images