Powershell – detect internet explorer version on remote machine

powershellremote-access

I'm trying to detect internet explorer version on remote machine. After some search with google I've wrote this. I'm testing it on local machine

$pc = "."    
$key = "SOFTWARE\Microsoft\Internet Explorer"                                                                        
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $pc)         
$regKey = $reg.OpenSubKey($key)           
$regkey.GetValue("Version")

but it returns me a lot of errors.

 Eccezione durante la chiamata di "OpenRemoteBaseKey" con "2" argomento/i: "Impossibile trovare il percorso di rete.
    "
    In riga:3 car:56
    + $reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey <<<< ('LocalMachine', $pc)         
        + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
        + FullyQualifiedErrorId : DotNetMethodException


Impossibile chiamare un metodo su un'espressione con valore null.
In riga:4 car:26
+ $regKey = $reg.OpenSubKey <<<< ($key)           
    + CategoryInfo          : InvalidOperation: (OpenSubKey:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

Impossibile chiamare un metodo su un'espressione con valore null.
In riga:5 car:17
+ $regkey.GetValue <<<< ("Version")
    + CategoryInfo          : InvalidOperation: (GetValue:String) [], RuntimeException
    + FullyQualifiedErrorId : InvokeMethodOnNull

I hope someone can give me some advice. Thanks.
edit. I've found this link
http://archive.msdn.microsoft.com/PSRemoteRegistry

Is this module absolutely necessary to query registry on remote machines?

Best Solution

You can query remote registry without that module. PSRemoteRegistry module only makes it easy. However, the requirement is to have remote registry service enabled and running on the remote machine. For an example, without the PSremoteRegistry module, check my blog post: http://www.ravichaganti.com/blog/?p=1920

Also, try at an elevated PowerShell console. You need admin rights to query remote registry. This is what I found on my system.

Related Question