Hello,
I have attempted the following script to get a list of just teachers and staff who have been created within the past 3 days however its not working.
Does anyone know where I have gone wrong?
$Global:Date = Get-Date
$DateBehind = $date.adddays(-3)
$DateChange = $DateBehind.ToShortDateString()
$DateNew = $DateChange -replace "/","-"
Get-QADUser -Title "teacher","staff" ` -SizeLimit 0 ` -includedproperties whenCreated, DN |
Where-Object -Filter {$_.WhenCreated.ToShortDateString() -ge $DateNew } |
ForEach-Object{
$DN = $_.DN
$dn1 = $DN -replace "CN=.*,OU=foo2,OU=",""
$School = $dn1 -replace ",OU=foo1,DC=foo,DC=co,DC=uk",""
$User1 = $User -replace "stuffhere\\" , "" }
| Out-File "C:\PastAccounts.txt"
Many Thanks
James