locked
Need to find the version of IE on all domain computers. RRS feed

  • Question

  • I need to find the Internet Explorer version on each of the computers in our domain. I have a powershell script that works if the computer is online but fails if the computer is off line or worse give a false version for that computer. See Script below:

                                

    $array =@() 
    $keyname = 'SOFTWARE\\Microsoft\\Internet Explorer' 
    $computernames = Get-Content C:\apps\Computer.csv 
    foreach ($server in $computernames) 

    $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $server) 
    $key = $reg.OpenSubkey($keyname)
    $value = $key.GetValue('Version') 
    $value1 = $key.GetValue('svcUpdateVersion') 
     $obj = New-Object PSObject 

            $obj | Add-Member -MemberType NoteProperty -Name "ComputerName" -Value $server 

            $obj | Add-Member -MemberType NoteProperty -Name "Base_IEVersion" -Value $value 

            $obj | Add-Member -MemberType NoteProperty -Name "Updated_IEVersion" -Value $value1 

            $array += $obj   


    $array | select ComputerName, Base_IEVersion, Updated_IEVersion | export-csv C:\apps\IE_Version.csv

    What I was thinking is to add a connection test using the Test-Connection cmdlet. What I would like to happen is if the computer is online and the test-connection returns a "true" the script returns the reg key values and write them to the array but if the computer is not online then the script write the $server variable to the array and moves on.  In the end I would then have a list of the computer names and the IE version for those that are online and I could easily see the computers that I would have to revisit. Any ideas?


    Alan Schroeder

    Wednesday, December 9, 2015 7:07 PM

Answers

All replies

  • You can also do an "IF EXIST" on "iExplore.exe" which kills 2 birds with one stone, both confirming the machine is online and you have access/can see the file...

    Jack

    Wednesday, December 9, 2015 7:30 PM
  • What have you tried?  If you are going to export you need to write more than a name to the output.

    I recommend spending some time learning basic PowerShell then rewrite the scrtp you have found so that it works with an export command.

    You could also ask the person who wrote your script for help.  It would likely help that person to learn about how to use PowerShell too.

    Here is a starter:

    $keyname = 'SOFTWARE\\Microsoft\\Internet Explorer'
    $props=@{
    	ComputerName=$null
    	Base_IEVersion=$null
    	Updated_IEVersion=$Null
    }
    
    Get-Content C:\apps\Computer.csv |
    	ForEach-Object{
    		$props.ComputerName=$_
    		Try{
    			$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $_)
    			$key = $reg.OpenSubkey($keyname)
    			$props.Base_IEVersion = $key.GetValue('Version')
    			$props.Updated_IEVersion=$key.GetValue('svcUpdateVersion')
        		}
    		Catch{}
    		[PSCustomObject]$props
    	} |
    	Export-Csv C:\apps\IE_Version.csv

    To understand how t use this you will need t look up the commands and the structures. There are dozems of blog posts explain how touse PowerShellin this way.


    \_(ツ)_/


    • Edited by jrv Wednesday, December 9, 2015 7:38 PM
    Wednesday, December 9, 2015 7:38 PM
  • You are in luck. I have published a script in the gallery that retrieves the iexplore.exe file version from one or more computers.

    https://gallery.technet.microsoft.com/scriptcenter/Get-IEVersionps1-44863ea8


    -- Bill Stewart [Bill_Stewart]

    • Proposed as answer by Vadim Shupak Wednesday, December 9, 2015 9:21 PM
    • Marked as answer by Bill_Stewart Tuesday, January 12, 2016 9:04 PM
    Wednesday, December 9, 2015 8:26 PM
  • Bill,

    You script works great, but how can you feed the script a list of computer name from a CSV file.


    Alan Schroeder

    Wednesday, December 9, 2015 11:54 PM
  • Something like:


    PS C:\> Get-Content ComputerList.txt | Get-IEVersion | Export-Csv Results.csv -NoTypeInformation


    -- Bill Stewart [Bill_Stewart]


    • Edited by Bill_Stewart Thursday, December 10, 2015 2:44 PM
    Thursday, December 10, 2015 10:31 AM
  • Thank you bill you have saved me a ton of work and alerted me to some AD cleanup that is needed 

    Alan Schroeder

    Thursday, December 10, 2015 6:26 PM