Get Remote Registry value.is there a way to get value of a registry from remote computer..I am trying to values of these keys...<br/> <br/> HKEY_LOCAL_MACHINE\SOFTWARE\MQUEST\ScriptEngine\Program\PrimaryScriptServer<br/> HKEY_LOCAL_MACHINE\SOFTWARE\MQUEST\ScriptEngine\Program\SecondaryScriptServer<br/> HKEY_LOCAL_MACHINE\SOFTWARE\MQUEST\ScriptEngine\Program\Server1<br/> HKEY_LOCAL_MACHINE\SOFTWARE\MQUEST\ScriptEngine\Program\Server2<span class=system> <br/> <br/> any help is greatly appreciated.</span>© 2009 Microsoft Corporation. All rights reserved.Fri, 19 Jun 2009 16:18:39 Zd2a3fd4e-474c-4f74-aa46-ead355c9669bhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#d2a3fd4e-474c-4f74-aa46-ead355c9669bhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#d2a3fd4e-474c-4f74-aa46-ead355c9669bLaserduehttp://social.technet.microsoft.com/Profile/en-US/?user=LaserdueGet Remote Registry value.is there a way to get value of a registry from remote computer..I am trying to values of these keys...<br/> <br/> HKEY_LOCAL_MACHINE\SOFTWARE\MQUEST\ScriptEngine\Program\PrimaryScriptServer<br/> HKEY_LOCAL_MACHINE\SOFTWARE\MQUEST\ScriptEngine\Program\SecondaryScriptServer<br/> HKEY_LOCAL_MACHINE\SOFTWARE\MQUEST\ScriptEngine\Program\Server1<br/> HKEY_LOCAL_MACHINE\SOFTWARE\MQUEST\ScriptEngine\Program\Server2<span class=system> <br/> <br/> any help is greatly appreciated.</span>Mon, 04 May 2009 14:09:54 Z2009-05-04T14:09:54Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#f9f937a2-fc67-48a6-865d-f12b299ded46http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#f9f937a2-fc67-48a6-865d-f12b299ded46Grégory Schirohttp://social.technet.microsoft.com/Profile/en-US/?user=Gr%u00e9gory%20SchiroGet Remote Registry value.Hi,<br/><br/> <p>You can use:</p> <p>$strMachineName = '.'<br/>$objReg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $strMachineName)<br/>$objRegKey= $objReg.OpenSubKey(&quot;SYSTEM\\SOFTWARE\MQUEST\\ScriptEngine\\Program\\PrimaryScriptServer&quot; )<br/>$objRegkey.GetValueNames()<br/><br/>Hope it helps.</p><hr class="sig">Grégory Schiro - <a href="http://scriptingof.blogspot.com">PowerShell &amp; MOF</a>Mon, 04 May 2009 15:24:50 Z2009-05-04T15:24:50Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#e7740dce-2451-4203-b3aa-4fcd0cdd3b98http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#e7740dce-2451-4203-b3aa-4fcd0cdd3b98Laserduehttp://social.technet.microsoft.com/Profile/en-US/?user=LaserdueGet Remote Registry value.getting error here is the debug output<br/> <br/> DEBUG:    1+ ./reg1.ps1<br/> DEBUG:     ! CALL script 'reg1.ps1'<br/> DEBUG:    1+ $strMachineName = 'MURBAMEXV004'<br/> DEBUG:     ! SET $strMachineName = 'MURBAMEXV004'.<br/> DEBUG:    2+ $objReg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $strMachineName)<br/> DEBUG:     ! CALL method 'static Microsoft.Win32.RegistryKey OpenRemoteBaseKey(RegistryHive hKey, String machineName)'<br/> DEBUG:     ! SET $objReg = 'HKEY_LOCAL_MACHINE'.<br/> DEBUG:    3+ $objRegKey= $objReg.OpenSubKey(&quot;SYSTEM\\SOFTWARE\MQUEST\\ScriptEngine\\Program\\PrimaryScriptServer&quot; )<br/> DEBUG:     ! CALL method 'Microsoft.Win32.RegistryKey OpenSubKey(String name)'<br/> DEBUG:     ! SET $objRegKey = ''.<br/> DEBUG:    4+ $objRegkey.GetValueNames()<br/> DEBUG:    2+                                     if ($ErrorView -ne &quot;CategoryView&quot;) {<br/> DEBUG:    3+                                        $myinv = $_.InvocationInfo<br/> DEBUG:     ! SET $myinv = 'System.Management.Automation.InvocationInfo'.<br/> DEBUG:    4+                                        switch -regex ($myinv.MyCommand.CommandType)<br/> DEBUG:   24+                                                if ($myinv.MyCommand.Name)<br/> DEBUG:    2+                                     if ($_.InvocationInfo) {<br/> DEBUG:    3+                                         $posmsg = $_.InvocationInfo.PositionMessage<br/> DEBUG:     ! SET $posmsg = '<br/> At C:\reg1.ps1:4 char:25<br/> + $objRegkey.GetValueNames( ...'.<br/> DEBUG:    7+                                     if ($ErrorView -eq &quot;CategoryView&quot;) {<br/> DEBUG:   11+                                         $_.Exception.Message + $posmsg<br/> You cannot call a method on a null-valued expression.<br/> At C:\reg1.ps1:4 char:25<br/> + $objRegkey.GetValueNames( &lt;&lt;&lt;&lt; )Mon, 04 May 2009 15:36:14 Z2009-05-04T15:36:14Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#c3f0085d-facb-4ce4-adf3-010ddc4d748ahttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#c3f0085d-facb-4ce4-adf3-010ddc4d748aLaserduehttp://social.technet.microsoft.com/Profile/en-US/?user=LaserdueGet Remote Registry value.IT is a Reg_SZ value i am trying to read if that helpsMon, 04 May 2009 16:21:24 Z2009-05-04T16:21:24Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#47acba75-0930-4749-b3de-826553689d8ehttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#47acba75-0930-4749-b3de-826553689d8eLaserduehttp://social.technet.microsoft.com/Profile/en-US/?user=LaserdueGet Remote Registry value.Rahter than getting the value it would be enough to check if the said keys exist<br/>Mon, 04 May 2009 16:27:29 Z2009-05-04T16:27:29Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#7c19656f-5f93-45a4-8ea3-7640a984073ehttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#7c19656f-5f93-45a4-8ea3-7640a984073ePravin Mestryhttp://social.technet.microsoft.com/Profile/en-US/?user=Pravin%20MestryGet Remote Registry value.<div>Hi,<br/>Please have a read of these articles</div> <div>PowerShell script to get remote registry key property<br/><a href="http://myitforum.com/cs2/blogs/yli628/archive/2008/12/11/powershell-script-to-get-remote-registry-key-property.aspx">http://myitforum.com/cs2/blogs/yli628/archive/2008/12/11/powershell-script-to-get-remote-registry-key-property.aspx</a></div>Tue, 05 May 2009 06:41:14 Z2009-05-05T06:41:14Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#09d837a0-cb80-4932-a874-57f2c7f448a8http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#09d837a0-cb80-4932-a874-57f2c7f448a8Vadims Podanshttp://social.technet.microsoft.com/Profile/en-US/?user=Vadims%20PodansGet Remote Registry value.$objRegKey= $objReg.OpenSubKey(&quot;SOFTWARE<strong>\</strong>\MQUEST\\ScriptEngine\\Program\\PrimaryScriptServer&quot; )<br/>one slash is missed.  And remove SYSTEM in key path. <hr class=sig> [тут могла быть ваша реклама] http://www.sysadmins.lvTue, 05 May 2009 07:53:41 Z2009-05-05T08:04:57Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#34e901e2-d1e3-42ba-9ae1-2cc6d52e7704http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#34e901e2-d1e3-42ba-9ae1-2cc6d52e7704Laserduehttp://social.technet.microsoft.com/Profile/en-US/?user=LaserdueGet Remote Registry value.Still getting same error<br/>Tue, 05 May 2009 08:42:13 Z2009-05-05T08:42:13Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#537113c9-6d0e-43a9-8fc5-39fae256d24ahttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#537113c9-6d0e-43a9-8fc5-39fae256d24aVadims Podanshttp://social.technet.microsoft.com/Profile/en-US/?user=Vadims%20PodansGet Remote Registry value.please, show your code.<hr class="sig">[тут могла быть ваша реклама] http://www.sysadmins.lvTue, 05 May 2009 14:00:26 Z2009-05-05T14:00:26Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#57e99f16-5034-40e2-b9c4-0402e1359f5bhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#57e99f16-5034-40e2-b9c4-0402e1359f5bLaserduehttp://social.technet.microsoft.com/Profile/en-US/?user=LaserdueGet Remote Registry value.$strMachineName = 'MURBAMEXV004'<br/> $objReg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $strMachineName)<br/> $objRegKey= $objReg.OpenSubKey(&quot;SOFTWARE\\MQUEST\\ScriptEngine\\Program\\PrimaryScriptServer&quot; )<br/> $objRegkey.GetValueNames(Fri, 08 May 2009 11:18:48 Z2009-05-08T11:18:48Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#8a211191-60b1-4790-b9e1-e177ce709fc4http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#8a211191-60b1-4790-b9e1-e177ce709fc4Vadims Podanshttp://social.technet.microsoft.com/Profile/en-US/?user=Vadims%20PodansGet Remote Registry value.this fine works for me. Are you sure that this key exist in HKLM\SOFTWARE\MQUEST\ScriptEngine\Program\PrimaryScriptServer on MURBAMEXV004?<hr class="sig">[тут могла быть ваша реклама] http://www.sysadmins.lvFri, 08 May 2009 17:37:18 Z2009-05-08T17:37:18Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#a2150e9f-3f59-4412-a442-ea3919721124http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#a2150e9f-3f59-4412-a442-ea3919721124Laserduehttp://social.technet.microsoft.com/Profile/en-US/?user=LaserdueGet Remote Registry value.<br/> PS C:\&gt; ./reg1.ps1<br/> You cannot call a method on a null-valued expression<br/> At C:\reg1.ps1:4 char:25<br/> + $objRegkey.GetValueNames &lt;&lt;&lt;&lt; ()<br/> <br/> i have check that machine even in 005 the key exist...I can pull if from this VBS..<br/> <br/> <br/> Set oReg = GetObject(&quot;winmgmts:{impersonationLevel=impersonate}!\\&quot; &amp; strComputer &amp; &quot;\root\default:StdRegProv&quot;)<br/> strKeyPath = &quot;SOFTWARE\MQUEST\ScriptEngine\Program\&quot;<br/> strValueName = &quot;PrimaryScriptServer&quot;<br/> oReg.GetStringValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,strValue<br/> verFn = StrValueMon, 11 May 2009 14:57:09 Z2009-05-11T14:57:09Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#94273e4b-e81d-4736-86bc-543f54cc0141http://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#94273e4b-e81d-4736-86bc-543f54cc0141Vadims Podanshttp://social.technet.microsoft.com/Profile/en-US/?user=Vadims%20PodansGet Remote Registry value.I understand. In your VBS code is shown that SOFTWARE\MQUEST\ScriptEngine\Program\ is Key path. However PrimaryScriptServer is not a key, but value. And code above retrives only names. If you want to get particular name value, you can use :<br/><br/>$strMachineName = 'MURBAMEXV004'<br/>$objReg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $strMachineName)<br/>$objRegKey= $objReg.OpenSubKey(&quot;SOFTWARE\\MQUEST\\ScriptEngine\\Program&quot; )<br/>$objRegKey.GetValue(&quot;PrimaryScriptServer&quot;)<br/><br/>If I understand correctly, this code should work. And after this you can read data for values:<br/>$strMachineName = 'MURBAMEXV004'<br/>$objReg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey('LocalMachine', $strMachineName)<br/>$objRegKey= $objReg.OpenSubKey(&quot;SOFTWARE\\MQUEST\\ScriptEngine\\Program&quot; )<br/>&quot;PrimaryScriptServer&quot;, &quot;SecondaryScriptServer&quot;, &quot;Server1&quot;, &quot;Server2&quot; | %{<br/>&quot;Data for value &quot; + $_<br/>$objRegKey.GetValue(&quot;$_&quot;)<br/>}<br/>or place values to variable:<br/>$values = &quot;PrimaryScriptServer&quot;, &quot;SecondaryScriptServer&quot;, &quot;Server1&quot;, &quot;Server2&quot;<br/><br/>and query:<br/>$values | %{<br/>&quot;Data for value &quot; + $_<br/>$objRegKey.GetValue(&quot;$_&quot;)<br/>}<hr class="sig">[тут могла быть ваша реклама] http://www.sysadmins.lvMon, 11 May 2009 18:15:55 Z2009-05-11T18:15:55Zhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#8219519b-f4c4-407f-8b6b-a4ff04864fcbhttp://social.technet.microsoft.com/Forums/en-US/winserverpowershell/thread/d2a3fd4e-474c-4f74-aa46-ead355c9669b#8219519b-f4c4-407f-8b6b-a4ff04864fcbTord Bergsethttp://social.technet.microsoft.com/Profile/en-US/?user=Tord%20BergsetGet Remote Registry value.Why make it so hard when it can be done so easy :-)<br/><br/><span style="font-size:x-small;color:#0000ff;font-family:Arial">reg query &quot;\\&lt;computername&gt;\HKLM\<span style="color:#000000">SOFTWARE\MQUEST\ScriptEngine\Program\PrimaryScriptServer<br/></span><br/>Check the &quot;reg query /?&quot; command for details<br/><br/>To get info from several machines this command can be used:<br/>for  %i in (server1,server2,server3) do reg query &quot;<a>\\%i\HKLM\SYSTEM\CurrentControlSet\Control\Session</a> Manager\Memory Management&quot; /v SessionPoolSize<br/><br/>This is an example to get/query a given registry key value for all servers in a Terminal Server farm (run from a TS):<br/>for /f &quot;skip=3 delims=* &quot; %i in ('qfarm /servers') do @echo --------------- %i --------------------- &amp;  reg query &quot;<a>\\%i\HKLM\SYSTEM\CurrentControlSet\Control\Session</a> Manager\Memory Management&quot; /v SessionPoolSize<br/><br/><br/>Have fun,<br/>Tord Bergset<br/></span>Fri, 19 Jun 2009 16:18:39 Z2009-06-19T16:23:42Z