Hello,
one of our developer need my below script in the LDAP syntax and i never tried this before, would you please help me
$date=get-date -Uformat %m-%d-%y
$Filepath = "c:\1\Student-Usage_$date.csv"
$Period=(new-timespan -start '01 Sep 2012' -end (Get-Date)).Days
$Students = @()
Get-QADGroup -Name "* Students" -SearchRoot "OU=Schools,DC=mydomain,DC=com" -SizeLimit 0 | Foreach{
$School = ($_.Name -split " ")[0]
$u = @($_ | Get-QADGroupMember -SizeLimit 0 )
$T = $u | get-qaduser -SizeLimit 0 -IncludedProperties extensionAttribute8,CN| Where-Object {$_.extensionAttribute8 -and $_.extensionAttribute8 -notmatch "013100|012100|011100"}
$f = $T | get-qaduser -SizeLimit 0 -NotLoggedOnFor $Period
$total=$T.count
$disabled=(@($T) | where {$_.AccountIsDisabled}).count
$NotLoggedOnFor=$f.count
$Enabled=$total-$disabled
$ActiveUsers=$Enabled-$NotLoggedOnFor
$Students += New-Object psobject -Property @{
School=$School
"Total Students" = $Enabled
"Active Students" = $ActiveUsers
}
}
$Students | export-csv $Filepath