2011-03-26 77 views
1

我試圖檢測遠程計算機上的Internet Explorer版本。經過谷歌搜索後,我寫了這個。我在本地機器上測試它檢測遠程計算機上的Internet Explorer版本

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

但它返回了很多錯誤。

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 

我希望有人能給我一些建議。謝謝。 編輯。我發現這個鏈接 http://archive.msdn.microsoft.com/PSRemoteRegistry

這個模塊對查詢遠程機器上的註冊表是否絕對必要?

+0

什麼樣的錯誤? – Pradeep 2011-03-26 11:33:21

+0

嗨。錯誤消息是意大利語,但如果它可以幫助我嘗試翻譯它。我將編輯我的帖子。 – 2011-03-26 11:52:37

回答

3

您可以在沒有該模塊的情況下查詢遠程註冊表。 PSRemoteRegistry模塊只能讓它變得簡單。但是,要求是遠程註冊表服務啓用並在遠程計算機上運行。例如,如果沒有PSremoteRegistry模塊,請查看我的博客文章:http://www.ravichaganti.com/blog/?p=1920

另外,請嘗試使用提升的PowerShell控制檯。您需要管理員權限才能查詢遠程註冊表。這是我在我的系統上找到的。

+0

嗨。再次感謝您的回覆。 :)我已經解決了你的建議。我已經在我的電腦上啓用了遠程註冊表,在這個鏈接的教程http://www.computerperformance.co.uk/windows7/windows7_registry_remote_enable.htm,現在甚至我的腳本運行良好。再次感謝。然後發生遠程註冊表服務將被啓用。我明白了:) – 2011-03-26 13:40:57

2

你知道你可以像使用Powershell一樣瀏覽註冊表嗎?

PS> Enter-PSSession -Computername "computer" 
PS[computer]> $reg = Get-Item ('HKLM:\Software\Microsoft\Internet Explorer\Version Vector') 
PS[computer]> $reg.GetValue("IE") 

或許:

PS> Invoke-Command -computername "computer" { $reg = Get-Item ('HKLM:\Software\Microsoft\Internet Explorer\Version Vector'); $reg.GetValue("IE") } 

您可能需要使用-credentials參數對任何這些命令來獲得訪問。並在您想要訪問的任何機器上安裝WinRM。

+0

謝謝。我會試一試:) – 2011-03-26 20:21:34

1

聽起來很簡單,但.. .. 使用資源管理器通過UNC路徑轉到遠程PC。 導航到iexplore, 右鍵單擊屬性,詳細信息選項卡。 IE信息有:)