Hi
I'm trying to write something to get a list of users created within a certain amount of days. I'm using get-qaduser and the get-date cmdlet. I beleive the problem is the format of the date in the CreationDate field and the format that is returned with the get-date cmdlet. Looking at the help I see that using the format -g option changes the date to the same format in the field but I'm usure how to then remove days using the adddays method. If I put the get-date -format g into a variable and pipe it through to get-member I notice that it changes it to a string type rather than the system.datetime type it was as get-date.
is there any way to acheive this?
My script is quite simple and looks like this:
$startdate = (get-date -format g).addDays(-7)
Get-qaduser | where { $_.creationdate -ge '$startdate' }
any help or advice would be appreciated.
Thanks
Lee