[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Define version IE on computers specific OU

Posted on 2014-02-12
8
Medium Priority
?
555 Views
Last Modified: 2014-02-20
Hi folks,

How might look script allowing to define version of Internet Explorer. on computers of specific organizational unit, considering the fact that IE maybe is embedded in the windows and maybe installed via windows update.

thanks
0
Comment
Question by:nesher13
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 29

Expert Comment

by:becraig
ID: 39854494
There is already a script out there to get IE version as it is recorded in the registry:

The approach would be:
1) do a get-adcomputer based on OU
2) filter that into a foreach loop and record the version:

$array =@() 
$keyname = 'SOFTWARE\\Microsoft\\Internet Explorer' 
$computernames = Get-ADComputer -Filter * | Where { $_.DistinguishedName -like "*$OU*" } 
#note there have been issues with using the -liek approach but it works for me
#you could probaby try  Get-ADComputer -SearchBase "ou=Grou,dc=demo,dc=com" 
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 IE_Version.csv

Open in new window

0
 

Author Comment

by:nesher13
ID: 39858631
becraig,


Open in new window

$array =@()
$keyname = 'SOFTWARE\\Microsoft\\Internet Explorer'
#$computernames = Get-ADComputer -Filter * | Where { $_.DistinguishedName -like "*$OU*" }
#note there have been issues with using the -liek approach but it works for me
#you could probaby try  Get-ADComputer -SearchBase "ou=Grou,dc=demo,dc=com"
$computernames = Get-ADComputer -Filter * -SearchBase "ou=w7,dc=demo,dc=com
foreach ($server in $computernames)
{
#$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $server)
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.RegistryHive]::'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:\Powershell\IE_Version.csv

Open in new window


I almost used your script, but I get error messages:

Exception calling "OpenRemoteBaseKey" with "2" argument(s): "The network path was not found.
"
At C:\Powershell\Scripts\IE-version.ps1:10 char:1
+ $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.Registr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : IOException
 
You cannot call a method on a null-valued expression.
At C:\Powershell\Scripts\IE-version.ps1:11 char:1
+ $key = $reg.OpenSubkey($keyname)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
You cannot call a method on a null-valued expression.
At C:\Powershell\Scripts\IE-version.ps1:12 char:1
+ $value = $key.GetValue('Version')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
Exception calling "OpenRemoteBaseKey" with "2" argument(s): "The network path was not found.
"
At C:\Powershell\Scripts\IE-version.ps1:10 char:1
+ $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.Registr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : IOException

You cannot call a method on a null-valued expression.
At C:\Powershell\Scripts\IE-version.ps1:11 char:1
+ $key = $reg.OpenSubkey($keyname)
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
You cannot call a method on a null-valued expression.
At C:\Powershell\Scripts\IE-version.ps1:12 char:1
+ $value = $key.GetValue('Version')
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull
 
Exception calling "OpenRemoteBaseKey" with "2" argument(s): "The network path was not found.
"
At C:\Powershell\Scripts\IE-version.ps1:10 char:1
+ $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey([Microsoft.Win32.Registr ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : IOException
 
You cannot call a method on a null-valued expression.
At C:\Powershell\Scripts\IE-version.ps1:11 char:1
+ $key = $reg.OpenSubkey($keyname) ...

and so on
0
 
LVL 29

Expert Comment

by:becraig
ID: 39859526
I did not include the select object for the computer name so it was actually trying to do a remote registry query for the entire DN.

Here is the updated version:

$array =@() 
$computernames = Get-ADComputer -Filter * | where {$_.distinguishedName -like "*OU=OuName,DC=DC,DC=DC*" } | select-object -expa Name
foreach ($server in $computernames) 
{
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $server) 
$key = $reg.OpenSubkey("SOFTWARE\Microsoft\Internet Explorer") 
$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 IE_Version.csv

Open in new window

0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 

Author Comment

by:nesher13
ID: 39860622
becraig

I am sorry, but I have found that on the remote computers  service  Remote Registry  was set to manual.  if you do not mind, let's continue our discussion after weekend.

Happy weekend!
0
 
LVL 29

Expert Comment

by:becraig
ID: 39860635
Ok np.

If you need to start remote registry on multiple servers you can just send a start control

for /f  %a in (listofservers.txt) do sc \\%a start remoteregistry  (if it is set to manual)
IF it is disabled you can run the below commands

for /f  %a in (listofservers.txt) do sc \\%a config remoteregistry start= manual
for /f  %a in (listofservers.txt) do sc \\%a start remoteregistry
0
 

Author Comment

by:nesher13
ID: 39870197
becraig

The test results revealed that:

1. it is necessary to use the "svcVersion" or "svcUpdateVersion" properties rather than the property "Version"

2. Output gives version of IE on the local machine which run the script
0
 
LVL 29

Accepted Solution

by:
becraig earned 2000 total points
ID: 39870639
I am not sure why you get the local version I just re-ran using the script and this is my output against 4 servers :

"ComputerName","IEVersion"
"Computer1","9.0.24"
"Computer2","9.0.24"
"Computer3","10.0.13"
"Computer4","9.0.24"


Here is the script used.

$array =@() 
$computernames = Get-ADComputer -Filter * | where {$_.distinguishedName -like "*OU=Accounting,OU=Services,OU=Companyarm,OU=branchoffice,OU=Properties,DC=contoso,DC=local*" } | select-object -expa Name
foreach ($server in $computernames) 
{
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $server) 
$key = $reg.OpenSubkey("SOFTWARE\Microsoft\Internet Explorer") 
$value = $key.GetValue('svcUpdateVersion') 
 $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 IE_Version.csv
                 

Open in new window

0
 

Author Comment

by:nesher13
ID: 39874631
becraig

thank you very match

It is working
0

Featured Post

Q2 2017 - Latest Malware & Internet Attacks

WatchGuard’s Threat Lab is a group of dedicated threat researchers committed to helping you stay ahead of the bad guys by providing in-depth analysis of the top security threats to your network.  Check out our latest Quarterly Internet Security Report!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The following article is intended as a guide to using PowerShell as a more versatile and reliable form of application detection in SCCM.
In the absence of a fully-fledged GPO Management product like AGPM, the script in this article will provide you with a simple way to watch the domain (or a select OU) for GPOs changes and automatically take backups when policies are added, removed o…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question