In that guide I should use a *.txt file where I should store every hosts, is it possible to have something like what I need but without to use a file with all hosts?
First of all - could you plesae not select DSC as the category for your question when it’s not about DSC?
Thanks in advance.
There shouldn’t be any local users when you have an AD. I’d recommend reviewing your processes or company rules according this topic.
Of course. You can use whatever data source fits your requirement.
Queries like this usually heavily depend on the availability of the local computer you want to query. If you have a sowftware deployment solution in place you could utilize this for this particular purpose.
Regardless of all that
Querying your AD for ALL computers and ALL of their properties puts a lot of stress to the DC you query. Especially when you actually throw away ALL additional properties you just queried except of the name. You should consider using a -SearchBase for your queries and querying only the properties you need. In this case this should be enough: