All,
I am trying to develop a script that queries a list of server and runs the below command to get the file versions. It looks in the dir listed and searches all subdirectories for anything with *.exe and reports the file version. The command below works and I am trying to figure out how to run this against multiple servers (txt file). I know how to run get-content to access the server list but I am confused at how to query the remote servers because Get-ChildItem does not have -ComputerName.
Can I use invoke-command? What other options do I have?
Get-ChildItem "C:\Program Files\ccleaner\" -Include *.exe -Recurse |Select-Object -ExpandProperty VersionInfo | select-object FileDescription, OriginalFilename, FileVersion | ft -AutoSize
OUTPUT from above command
FileDescription OriginalFilename FileVersion
--------------- ---------------- -----------
CCleaner ccleaner.exe 4, 10, 00, 4570
CCleaner ccleaner.exe 4, 10, 00, 4570
CCleaner Installer 2.0.0.0