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\\Micr osoft\\Int ernet Expl orer'
$computernames = Get-Conte nt C:\Comp uter.csv
foreach ($server in $compu ternames)
{
$reg = [Microsoft.Win32.Re gistryKey] ::OpenRemo teBaseKey( 'LocalMach ine', $ser ver)
$key = $reg.OpenSubkey($ke yname)
$value = $key.GetValue('Ve rsion')
$obj = New-Object PSObjec t
$obj | Add-Member -MemberTyp e NoteProp erty -Name "Computer Name" -Val ue $server
$obj | Add-Member -MemberTyp e NoteProp erty -Name "IEVersio n" -Value $value
$array += $obj
}
$array | select ComputerNa me,IEVersi on | expor t-csv IE_V ersion.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('Ve rsion')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~
+ 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.Re gistryKey] ::OpenRemo teBaseKey( 'LocalMach ine ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : UnauthorizedAccessExceptio n
You cannot call a method on a null-valued expression.
At line:8 char:1
+ $value = $key.GetValue('Ve rsion')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
$array =@()
$keyname = 'SOFTWARE\\Micr
$computernames = Get-Conte
foreach ($server in $compu
{
$reg = [Microsoft.Win32.Re
$key = $reg.OpenSubkey($ke
$value = $key.GetValue('Ve
$obj = New-Object PSObjec
$obj | Add-Member
$obj | Add-Member
$array += $obj
}
$array | select ComputerNa
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('Ve
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ 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.Re
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [], MethodInvocationException
+ FullyQualifiedErrorId : UnauthorizedAccessExceptio
You cannot call a method on a null-valued expression.
At line:8 char:1
+ $value = $key.GetValue('Ve
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvokeMethodOnNull
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Solution provided.