here you go:
gc Servers.txt | foreach
{ [system.diagnostics.fileversioninfo]::GetVersionInfo("\\$_\C`$
\program files\internet explorer\iexplore.exe") }
If you need a quick list of all the computers on your network to feed to that:
net view |% {if ($_ -match "^\\\\(\S+)"){$matches[1]}}
I tried your it out but am told this by Powershell:
PS C:\servers> gc Servers.txt | foreach
cmdlet ForEach-Object at command pipeline position 2
Supply values for the following parameters:
Process[0]: { [system.diagnostics.fileversioninfo]::GetVersionInfo("\\$_\C`$
Process[1]: \program files\internet explorer\iexplore.exe") }
Process[2]:
ForEach-Object : Cannot bind parameter 'Process'. Cannot convert the "{ [system.diagnostics.fileversioninfo]::Ge
nInfo("\\$_\C`$" value of type "System.String" to type "System.Management.Automation.ScriptBlock".
At line:1 char:25
+ gc Servers.txt | foreach <<<<
+ CategoryInfo : InvalidArgument: (:) [ForEach-Object], ParameterBindingException
+ FullyQualifiedErrorId : CannotConvertArgumentNoMessage,Microsoft.PowerShell.Commands.ForEachObjectCommand
You can also get it from the registry:
Invoke-Command -ComputerName (gc Servers.txt) {$env:COMPUTERNAME + " - "+ (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Internet Explorer').Version}
it should be all in one line and servers.txt should have the pcs you want to check for:
gc Servers.txt | foreach {[system.diagnostics.fileversioninfo]::GetVersionInfo("\\$_\C`$\program files\internet explorer\iexplore.exe") }