![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| | |||||||
| |
| 07-07-2006 | #1 (permalink) |
| | Re: Powershell remote registry access via WMI I you don't want "legal" problems you should probably change your name quickly..... "Microsoft" <> wrote in message news:OFVRsxgoGHA.4828@TK2MSFTNGP04.phx.gbl... > I'm having trouble getting to a remote registry via wmi using Powershell > version v2.0.50727. I tried the example from 'From > http://www.microsoft.com/technet/scr...mshandwmi.mspx > and > get the error below: > > PS C:\> $colItems = get-wmiobject -class "StdRegProv" -namespace > "root\default" -computername "myserver" > PS C:\> $colItems.EnumValues(0x80000002,"software\microsoft\windows > nt\currentversion",$Values,$Types) > You cannot call a method on a null-valued expression. > At line:1 char:21 > + $colItems.EnumValues( <<<< 0x80000002,"software\microsoft\windows > nt\currentversion",$Values,$Types) > > Using the .Net function [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey > works well as a work-around but I'm wondering what I'm doing wrong with > the > WMI call above. > f > > |
| My System Specs |
| 07-07-2006 | #2 (permalink) |
| | Powershell remote registry access via WMI I'm having trouble getting to a remote registry via wmi using Powershell version v2.0.50727. I tried the example from 'From http://www.microsoft.com/technet/scr...mshandwmi.mspx and get the error below: PS C:\> $colItems = get-wmiobject -class "StdRegProv" -namespace "root\default" -computername "myserver" PS C:\> $colItems.EnumValues(0x80000002,"software\microsoft\windows nt\currentversion",$Values,$Types) You cannot call a method on a null-valued expression. At line:1 char:21 + $colItems.EnumValues( <<<< 0x80000002,"software\microsoft\windows nt\currentversion",$Values,$Types) Using the .Net function [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey works well as a work-around but I'm wondering what I'm doing wrong with the WMI call above. f |
| My System Specs |
| 07-07-2006 | #3 (permalink) |
| | Re: Powershell remote registry access via WMI Use WBEMTEST or WMIC to see if you can see any instances. I don't see any on my machine. -- Jeffrey Snover [MSFT] Windows PowerShell Architect Microsoft Corporation This posting is provided "AS IS" with no warranties, no confers rights. Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scr.../hubs/msh.mspx "Microsoft" <benherman@hotmali.com> wrote in message news:OFVRsxgoGHA.4828@TK2MSFTNGP04.phx.gbl... > I'm having trouble getting to a remote registry via wmi using Powershell > version v2.0.50727. I tried the example from 'From > http://www.microsoft.com/technet/scr...mshandwmi.mspx > and > get the error below: > > PS C:\> $colItems = get-wmiobject -class "StdRegProv" -namespace > "root\default" -computername "myserver" > PS C:\> $colItems.EnumValues(0x80000002,"software\microsoft\windows > nt\currentversion",$Values,$Types) > You cannot call a method on a null-valued expression. > At line:1 char:21 > + $colItems.EnumValues( <<<< 0x80000002,"software\microsoft\windows > nt\currentversion",$Values,$Types) > > Using the .Net function [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey > works well as a work-around but I'm wondering what I'm doing wrong with > the > WMI call above. > f > > |
| My System Specs |
| 07-09-2006 | #4 (permalink) |
| | Re: Powershell remote registry access via WMI > "Microsoft" <benherman@hotmali.com> wrote in message > news:OFVRsxgoGHA.4828@TK2MSFTNGP04.phx.gbl... >> I'm having trouble getting to a remote registry via wmi using Powershell >> version v2.0.50727. I tried the example from 'From >> http://www.microsoft.com/technet/scr...mshandwmi.mspx >> and >> get the error below: "Jeffrey Snover [MSFT]" <jsnover@microsoft.com> wrote in message news:%23ehoS1joGHA.5104@TK2MSFTNGP04.phx.gbl... > Use WBEMTEST or WMIC to see if you can see any instances. I don't see any > on my machine. Yes. Of course, with the -List usage we can access the class itself rather than instances. Using the local system for demonstration purposes: $reg = Get-WmiObject -List -Namespace root\default -ComputerName . | Where-Object {$_.Name -eq "StdRegProv"} Unfortunately I've had serious issues trying to invoke methods on the resulting object. :| |
| My System Specs |
| 07-09-2006 | #5 (permalink) |
| | Re: Powershell remote registry access via WMI > Unfortunately I've had serious issues trying to invoke methods on the > resulting object. :| This improves in RC2: http://blogs.msdn.com/powershell/arc...26/647038.aspx PS> $reg = Get-WmiObject -List -Namespace root\default -ComputerName . | >> Where-Object {$_.Name -eq "StdRegProv"} >> PS> $reg.enumkey(2147483650,"software") __GENUS : 2 __CLASS : __PARAMETERS __SUPERCLASS : __DYNASTY : __PARAMETERS __RELPATH : __PROPERTY_COUNT : 2 __DERIVATION : {} __SERVER : __NAMESPACE : __PATH : ReturnValue : 0 sNames : {Adobe, Alps, ALPS Electric Co., Ltd., Apple Computer, Inc....} -- Jeffrey Snover [MSFT] Windows PowerShell Architect Microsoft Corporation This posting is provided "AS IS" with no warranties, no confers rights. Visit the Windows PowerShell Team blog at: http://blogs.msdn.com/PowerShell Visit the Windows PowerShell ScriptCenter at: http://www.microsoft.com/technet/scr.../hubs/msh.mspx |
| My System Specs |
| 07-10-2006 | #6 (permalink) |
| | Re: Powershell remote registry access via WMI "Jeffrey Snover [MSFT]" <> wrote in message news:u2LIjU3oGHA.4424@TK2MSFTNGP05.phx.gbl... >> Unfortunately I've had serious issues trying to invoke methods on the >> resulting object. :| > This improves in RC2: > > http://blogs.msdn.com/powershell/arc...26/647038.aspx I saw that. ![]() It will definitely help. It's also possible right now to use PSBase and directly invoke EnumKeys and so on as normal methods; the primary problems I've had are with the need for uint32-typed values for the hive constant, and the fact that one of the parameters needs to be a ref array. That's more of a general WMI "design safety" issue I think... > PS> $reg = Get-WmiObject -List -Namespace root\default -ComputerName . | >>> Where-Object {$_.Name -eq "StdRegProv"} >>> > PS> $reg.enumkey(2147483650,"software") > > > __GENUS : 2 > __CLASS : __PARAMETERS > __SUPERCLASS : > __DYNASTY : __PARAMETERS > __RELPATH : > __PROPERTY_COUNT : 2 > __DERIVATION : {} > __SERVER : > __NAMESPACE : > __PATH : > ReturnValue : 0 > sNames : {Adobe, Alps, ALPS Electric Co., Ltd., Apple Computer, > Inc....} > > -- > Jeffrey Snover [MSFT] > Windows PowerShell Architect > Microsoft Corporation > This posting is provided "AS IS" with no warranties, no confers rights. > Visit the Windows PowerShell Team blog at: > http://blogs.msdn.com/PowerShell > Visit the Windows PowerShell ScriptCenter at: > http://www.microsoft.com/technet/scr.../hubs/msh.mspx > > |
| My System Specs |
| 07-10-2006 | #7 (permalink) |
| | Re: Powershell remote registry access via WMI Thank you for the responses. I'll try this as soon as I can get my sweaty little mits on RC2. (And I'll fix my newsreader to show my name). Ben Herman "Alex K. Angelopoulos [MVP]" wrote: > > "Jeffrey Snover [MSFT]" <> wrote in message > news:u2LIjU3oGHA.4424@TK2MSFTNGP05.phx.gbl... > >> Unfortunately I've had serious issues trying to invoke methods on the > >> resulting object. :| > > This improves in RC2: > > > > http://blogs.msdn.com/powershell/arc...26/647038.aspx > > I saw that. ![]() > > It will definitely help. It's also possible right now to use PSBase and > directly invoke EnumKeys and so on as normal methods; the primary problems > I've had are with the need for uint32-typed values for the hive constant, > and the fact that one of the parameters needs to be a ref array. That's more > of a general WMI "design safety" issue I think... > > > PS> $reg = Get-WmiObject -List -Namespace root\default -ComputerName . | > >>> Where-Object {$_.Name -eq "StdRegProv"} > >>> > > PS> $reg.enumkey(2147483650,"software") > > > > > > __GENUS : 2 > > __CLASS : __PARAMETERS > > __SUPERCLASS : > > __DYNASTY : __PARAMETERS > > __RELPATH : > > __PROPERTY_COUNT : 2 > > __DERIVATION : {} > > __SERVER : > > __NAMESPACE : > > __PATH : > > ReturnValue : 0 > > sNames : {Adobe, Alps, ALPS Electric Co., Ltd., Apple Computer, > > Inc....} > > > > -- > > Jeffrey Snover [MSFT] > > Windows PowerShell Architect > > Microsoft Corporation > > This posting is provided "AS IS" with no warranties, no confers rights. > > Visit the Windows PowerShell Team blog at: > > http://blogs.msdn.com/PowerShell > > Visit the Windows PowerShell ScriptCenter at: > > http://www.microsoft.com/technet/scr.../hubs/msh.mspx > > > > > > > |
| My System Specs |
| Thread Tools | |
| |
| Similar topics to: Powershell remote registry access via WMI | ||||
| Thread | Forum | |||
| Remote registry key recurse in powershell | PowerShell | |||
| Remote registry access | PowerShell | |||
| PowerShell and Registry Access | Software | |||
| Remote Registry Access | PowerShell | |||
| Remote registry access in Powershell | PowerShell | |||