I am looking for a way to get WMIC to read a file will a list of hostnames and to return the currently logged on user if any.
At the moment I am just using wmic /node: "hostname" COMPUTERSYSTEM GET USERNAME.
This works fine for a single system, I would like to do it for nine and have the output look as such
hostname username
hostname username
or
hostname
username
Thanks
Solved it
@echo offfor /f %%a in (hostnames.txt) do WMIC /NODE:%%a COMPUTERSYSTEM GET USERNAME
pause