Link to home
Start Free TrialLog in
Avatar of stressedout2004
stressedout2004

asked on

Get All Versions Of IE In A Domain

I need a script to get all versions of IE installed in Domain.   This script throws the following error.

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

$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $server) 
$key = $reg.OpenSubkey($keyname) 
$value = $key.GetValue('Version') 
 $obj = New-Object PSObjec
         
        $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 IE_Version.csv

https://gallery.technet.microsoft.com/scriptcenter/FInd-IE-Version-on-Remote-e6d5075c



You cannot call a method on a null-valued expression.
At line:8 char:1
+ $value = $key.GetValue('Version')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
Exception calling "OpenRemoteBaseKey" with "2" argument(s): "Attempted to perform an unauthorized operation."
At line:6 char:1
+ $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : UnauthorizedAccessException
 
You cannot call a method on a null-valued expression.
At line:8 char:1
+ $value = $key.GetValue('Version')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
ASKER CERTIFIED SOLUTION
Avatar of oBdA
oBdA

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of oBdA
oBdA

Solution provided.