I have a text file of every machine in our Windows Active Directory domain, and I would like to determine the currently logged in user (if any) and operating system of each machine using WMIC:
WMIC /NODE:<machine_name> COMPUTERSYSTEM GET USERNAME
WMIC /NODE:<machine_name> OS GET caption
Does anyone know how this could be scripted to read my list of computers from a text file and execute the two WMIC commands for each and output the results in the format:
ComputerName, OperatingSystem, CurrentUserName