When you post code, error messages, sample data or console output format it as code, please.
In the “Text” view you can use the code tags “PRE”, in the “Visual” view you can use the format template “Preformatted”. You can go back edit your post and fix the formatting - you don’t have to create a new one.
Thanks in advance.
To reduce the stress you put on your DC with a query like this I urgently recommend using the -SearchBase parameter for Get-ADUser. It would also be faster when you use the -Filter parameter of Get-ADUser instead of filtering the results provided by it later with a Where-Object.
The actual mistake you did - you forgot to pipe the output of “select -ExpandProperty Name” to Foreach-Object.
Further to the earlier post, I’ve been attempting to filter by computer name then show for each the last update for each filtered Windows 10 client using this script:
In response I am getting the following error message:
-SearchBase : The term ‘-SearchBase’ is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:47 + Get-ADComputer -Filter “Name -like ‘abcad*’” | -SearchBase $SearchBase | + ~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (-SearchBase:String) , CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
-SearchBase is parameter for the cmdlet Get-ADUser. Please always read the complete help including the examples for the cmdlets you’re about to use to learn how to use them.