0

I am trying find any typos in user zip code entries. We have a file with all zip codes that helpdesk use when creating users.

Using Get-ADUser -Filter * -Properties POBox | select POBox I am able to get all PObox entry for all users.

Next step is to check zip codes in the text file glocodes and if entry does not match it should output to console.

$GLCODES= Get-Content glcodes.txt
Get-ADUser -Filter * -Properties POBox |
    select POBox |
    ? {$_.POBox -notcontains $GLCODES}

Please suggest.

1 Answer 1

2

It seems you have the operands in switched places. As far as I get from syntax, it should be:

{ $GLCODES -notcontains $_.POBox }

Syntax:

<Reference-values> -contains <Test-value>

Microsoft docs:: About Comparison Operators

Sign up to request clarification or add additional context in comments.

1 Comment

Starting with PowerShell v3 you could also use <Test-value> -in <Reference-values>.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.