When I am running the below script portion I am encountering error “Where-Object : A parameter cannot be found that matches parameter name ‘SearchBase’.” I am sure that the searchbase path given is correct. Any help would be much appreciated. Thanks in advance.
the error message does not complain about the value you provided for the paramter -SearchBase! You provided the parameter for the cmdlet Where-Object not Get-ADUser. The proper command line should look something like this:
If you take a look at your post you may notice that your code is actually broken. That happens when you do not format it as code. To do so, please, next time you post code place your cursor in an empty line click on the preformatted text button ( </> ) and paste your code.