I need to have the follow fields in it
Naam User
Datum Creation
Land User
Attr 6
Password never exp
CannotChange password
Password NOT required
Notes field
Email address
I cant figure out what for names i need to use for
well, i usually take 2 approaches when trying to figure out attribute names on ad objects, one, i just look at a single object with -prop *
if i can’t easily figure out just reading through the list, i default to looking at the help for set-aduser. https://technet.microsoft.com/en-us/library/ee617215.aspx
for these i see:
PasswordNeverExpires
CannotChangePassword
PasswordNotRequired
be aware, the notes field is a multi-value field so it requires more work/thought
But there will be the question i want to see only the users that passwordneverexpires is false,
Wich command do i need for that i tried serveral and tried google but no result
this is a scripting guy post that can show you how to deal with date objects (and specifically the whencreated attribute, just ignore the quest cmdlet references)
First of all thank you for all the information and support.
I thought wy not share my final script with you guys.
at the end i have scripted that it will be outputted to html, for that i do a quick training to create fancy reports
If you have some tips just give them.
system.reflection.assembly]::loadwithpartialname('microsoft.visualbasic') | Out-Null
$Country = [microsoft.visualbasic.interaction]::inputbox('Fill in the Country name in the short OU version','Country')
$givendate = [microsoft.visualbasic.interaction]::inputbox('Fill in the begin date of the month','Given Date')
$Lastdate = [microsoft.visualbasic.interaction]::inputbox('Fill in the last date of the month','Last Date')
$BeginDate = get-date $givendate
$EndDate = get-date $Lastdate
$OurUsers = Get-ADUser -SearchBase "OU=$country,DC=corp,DC=local" -filter * -Properties *
$OurUsers | Where-Object {$_.whencreated -gt $BeginDate} | Select-Object CN, SamAccountName,WhenCreated, Extensionattribute6, Mail, Description, Info, AccountExpirationDate, PasswordNeverExpires, CannotChangePassword, PasswordNotRequired| Sort-Object whencreated -Descending |convertto-HTML | Out-File C:\Scripts\HTML-Output\test.htm