Powershell: I got something wrong.
-
I think Dash is on the right trail. Try it without the
PasswordNeverExpires
parameter. -
OK
Get-ADUser -filter {PasswordNeverExpires -eq $false}
and
Get-ADUser -filter {PasswordNeverExpires -eq $false} -Properties PasswordLastSet,Name,Description
do work. Though I'm guessing that the -Properties option is meant to limit the output to only those three things, which it does not do, but I could be wrong on the expectation.
In either case, the output from both commands is the same. -
@eddiejennings said in Powershell: I got something wrong.:
I think Dash is on the right trail. Try it without the
PasswordNeverExpires
parameter.That param is fine. The dates are what's generating the error as it's not able to figure out both lt and gt, I think?
-
@grey said in Powershell: I got something wrong.:
@eddiejennings said in Powershell: I got something wrong.:
I think Dash is on the right trail. Try it without the
PasswordNeverExpires
parameter.That param is fine. The dates are what's generating the error as it's not able to figure out both lt and gt, I think?
yeah, when I only put that one filter in place, it's failing for me, the rest work.
-
@grey Specify PasswordLastSet after the
-and
also otherwise it has no idea what you are trying to-lt
.Get-ADUser -filter {PasswordNeverExpires -eq $false -and (PasswordLastSet -gt "8/16/2017" -and PasswordLastSet -lt "8/21/2017") -and enabled -eq $true} -Properties PasswordLastSet,Name,Description
-
damn - JB beat me by a few seconds
-
I should only respond to posts when I can give them due attention. I feel like a fool for missing that.
-
I wonder if you can drop the and, and give the -gt -lt commands to the single commandlet?
-
@dashrender said in Powershell: I got something wrong.:
I wonder if you can drop the and, and give the -gt -lt commands to the single commandlet?
not how that works.
-
@jaredbusch said in Powershell: I got something wrong.:
@dashrender said in Powershell: I got something wrong.:
I wonder if you can drop the and, and give the -gt -lt commands to the single commandlet?
not how that works.
Yeah I just tried, and nope failed.
-
@dashrender said in Powershell: I got something wrong.:
@jaredbusch said in Powershell: I got something wrong.:
@dashrender said in Powershell: I got something wrong.:
I wonder if you can drop the and, and give the -gt -lt commands to the single commandlet?
not how that works.
Yeah I just tried, and nope failed.
There is no
-between
functionality in powershell. -
@jaredbusch said in Powershell: I got something wrong.:
@grey Specify PasswordLastSet after the
-and
also otherwise it has no idea what you are trying to-lt
.Get-ADUser -filter {PasswordNeverExpires -eq $false -and (PasswordLastSet -gt "8/16/2017" -and PasswordLastSet -lt "8/21/2017") -and enabled -eq $true} -Properties PasswordLastSet,Name,Description
You win at the Internet today. I should have caught that.
-
@grey said in Powershell: I got something wrong.:
@jaredbusch said in Powershell: I got something wrong.:
@grey Specify PasswordLastSet after the
-and
also otherwise it has no idea what you are trying to-lt
.Get-ADUser -filter {PasswordNeverExpires -eq $false -and (PasswordLastSet -gt "8/16/2017" -and PasswordLastSet -lt "8/21/2017") -and enabled -eq $true} -Properties PasswordLastSet,Name,Description
You win at the Internet today. I should have caught that.
I did enough time in development. I know how it goes.