I am using the following script to find the version of Internet Explorer on all the computers in my domain and it works but there are a couple of problems.
First it takes a long time to run. I believe this is due to the script taking awhile to determine that a computer isn't connected to the domain. I'd like to use the test-connection feature but I'm having an issue getting that to work.
Second, once it determines the computer isn't on it uses the version of the last computer it connected to until it connects to a computer. I know this because I've run the script a couple of times on computers I can turn on and off and I get different versions depending on the state of the computer.
Any help would be appreciated.
Thanks,
Andy
$array =@()
$keyname = 'SOFTWARE\\Microsoft\\Internet Explorer'
$computernames = Get-Content "F:\Powershell Projects\Data Files\servers.csv"
foreach ($server in $computernames)
{
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $server)
$key = $reg.OpenSubkey($keyname)
$value = $key.GetValue('Version')
$obj = New-Object PSObject
$obj | Add-Member -MemberType NoteProperty -Name "ComputerName" -Value $server
$obj | Add-Member -MemberType NoteProperty -Name "IEVersion" -Value $value
$array += $obj
}
$array | select ComputerName,IEVersion | export-csv C:\Users\achurchill\Desktop\IE_Version.csv