Hello,
I am a beginner with powershell, and I am doing a lot of reading throughout the forums.
I have been trying to use several script lines I have found in here to lastly achieve my ultimate goal, which is to get the users who hold the password never expires enabled while at their sam account name doesn't contain the letter P nor V in it.
this is what "i" came up with so far:
$users | ? {_.userprincipalname -notlike "v*"} | ? {_.userprincipalname -notlike "p*"} | select userp*
where $users contain Get-ADUser -Filter *
this next script line i found right here on this forum and it goes like:
Get-ADUser -Filter {(PasswordNeverExpires -eq "True") -and (Enabled -eq "True")}
the first script line shows any users in the Get-ADUser -Filter * that doesn't contain the Letters P nor V in the SamAccountName parameter.
the 2nd script line shows the users who are enabled and with their password never to expire.
for some reason (other than me being a complete tard), I am unable to merge the 2 scripts.
any help on that matter?
thanks in advance,
Roy.