Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

PowerShell and StdRegProv

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 10-16-2006   #1 (permalink)
T
Guest


 

PowerShell and StdRegProv

Any idea why this returns an empty collection:
$colItems = get-wmiobject -class "StdRegProv" -namespace "root\default"
-computername "."

This is from:
http://www.microsoft.com/technet/scr...mshandwmi.mspx

I'm going to assume what was posted is wrong. Can you please post the
correct command.

Thanks

T

My System SpecsSystem Spec
Old 10-17-2006   #2 (permalink)
klumsy@xtra.co.nz
Guest


 

Re: PowerShell and StdRegProv

i have never used the class stdregprov, however when i do get-wmiobject
-list , on my computer there is no class by that name, so maybe for
some reason its not installed also on your computer..
if you do get-wmiobject -list , you'll see a number of registry classes
as you are using . as the computername, and just using your own
computer, you can use the powershell registry provider i.,e

dir HKLM:\SOFTWARE

or

CD HKCU:\
dir

and interact with the registry in a similar manner you do with a
filesystem.

T wrote:
> Any idea why this returns an empty collection:
> $colItems = get-wmiobject -class "StdRegProv" -namespace "root\default"
> -computername "."
>
> This is from:
> http://www.microsoft.com/technet/scr...mshandwmi.mspx
>
> I'm going to assume what was posted is wrong. Can you please post the
> correct command.
>
> Thanks
>
> T


My System SpecsSystem Spec
Old 10-17-2006   #3 (permalink)
klumsy@xtra.co.nz
Guest


 

Re: PowerShell and StdRegProv

from that help, the computer you are connecting to see the registry has
to be a server as per:


Requires Windows Server "Longhorn", Windows Server 2003, Windows 2000
Server, or Windows NT Server 4.0 SP4 and later.

My System SpecsSystem Spec
Old 10-17-2006   #4 (permalink)
Brian McDermott
Guest


 

Re: PowerShell and StdRegProv

You can find the StdRegProv on all Windows systems desktop or not. (As long
as they have WMI).


<klumsy@xtra.co.nz> wrote in message
news:1161064189.536443.227290@m73g2000cwd.googlegroups.com...
> from that help, the computer you are connecting to see the registry has
> to be a server as per:
>
>
> Requires Windows Server "Longhorn", Windows Server 2003, Windows 2000
> Server, or Windows NT Server 4.0 SP4 and later.
>



My System SpecsSystem Spec
Old 10-17-2006   #5 (permalink)
Brian McDermott
Guest


 

Re: PowerShell and StdRegProv

If you would like one of these object use the following command.

$Reg = [WMIClass]"root\default:StdRegProv"

It is worth pointing out though, that this class has no instances. In fact
WMI does NOT represent registry keys or values as WMI objetcs. The way that
WMI accesses the registry is via the many methods associated with the
StdProv object. To see the many objects available try

$Reg | gm

after you have run the first line of course or there will be no $Reg to look
at.

As you can then see, there are methods for retrieving all the different data
types in the registry and can check registry permissions and also enumerate
key contents.

So yes, while the code on the web page is not syntactically incorrect, it
isn't useful in that context.

Yours,

BrianMcD


"T" <T@discussions.microsoft.com> wrote in message
news:C495BB9A-D4F3-45A1-9B8E-BE7E9605EFA3@microsoft.com...
> Any idea why this returns an empty collection:
> $colItems = get-wmiobject -class "StdRegProv" -namespace "root\default"
> -computername "."
>
> This is from:
> http://www.microsoft.com/technet/scr...mshandwmi.mspx
>
> I'm going to assume what was posted is wrong. Can you please post the
> correct command.
>
> Thanks
>
> T



My System SpecsSystem Spec
Old 10-17-2006   #6 (permalink)
klumsy@xtra.co.nz
Guest


 

Re: PowerShell and StdRegProv

>You can find the StdRegProv on all Windows systems desktop or not. (As long
as they have WMI).

interesting,
hmm,
i wonder why it doesn't show up in get-wmiobject -list

My System SpecsSystem Spec
Old 10-17-2006   #7 (permalink)
dreeschkind
Guest


 

Re: PowerShell and StdRegProv

"klumsy@xtra.co.nz" wrote:

> >You can find the StdRegProv on all Windows systems desktop or not. (As long

> as they have WMI).
>
> interesting,
> hmm,
> i wonder why it doesn't show up in get-wmiobject -list
>


The default namespace of Get-WmiObject is "Root/cimv2", but StdRegProv is
located in the namespace "Root\default". Therefore, it won't be included in
the list.

PS> Get-WmiObject -namespace "Root\default" -list | ? {$_.name -match
"StdRegProv"}

--
greetings
dreeschkind
My System SpecsSystem Spec
Old 10-18-2006   #8 (permalink)
Alex K. Angelopoulos [MVP]
Guest


 

Re: PowerShell and StdRegProv

Sorry about not looking through this yesterday; I ran into the problem
myself earlier and used another approach that works:

$Reg = Get-WmiObject -Namespace Root\Default -List | Where-Object
{$_.Name -eq "StdRegProv"}

That was prior to RC 2 release; quite obviously, using [WMIClass] as you do
is both more compact and more efficient.


"Brian McDermott" <brian.mcdermottNOSPAM@qa.com> wrote in message
news:eo4KNCh8GHA.1560@TK2MSFTNGP04.phx.gbl...
> If you would like one of these object use the following command.
>
> $Reg = [WMIClass]"root\default:StdRegProv"
>
> It is worth pointing out though, that this class has no instances. In fact
> WMI does NOT represent registry keys or values as WMI objetcs. The way
> that WMI accesses the registry is via the many methods associated with the
> StdProv object. To see the many objects available try



My System SpecsSystem Spec
Old 11-09-2006   #9 (permalink)
jonathan.prater@gmail.com
Guest


 

Re: PowerShell and StdRegProv

Here's a question for you...
I run this in powershell on my computer:
$regobj = [wmiclass]"root/default:stdregprov"
$regobj now contains a class instance of StdRegProv. Now I need to
pull keys for it. I tried this:
$regkeys = $regobj.enumKey(2147483649, "software/microsoft")
According to everything I can figure out, that should pull an array of
all the subkeys in HKLM/Software/Microsoft into $regkeys. But this is
what I get instead:
PS > $regkeys | foreach { write-output $_ }


__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 2
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ReturnValue : 2
sNames :

Thoughts?

Alex K. Angelopoulos [MVP] wrote:
> Sorry about not looking through this yesterday; I ran into the problem
> myself earlier and used another approach that works:
>
> $Reg = Get-WmiObject -Namespace Root\Default -List | Where-Object
> {$_.Name -eq "StdRegProv"}
>
> That was prior to RC 2 release; quite obviously, using [WMIClass] as you do
> is both more compact and more efficient.
>
>
> "Brian McDermott" <brian.mcdermottNOSPAM@qa.com> wrote in message
> news:eo4KNCh8GHA.1560@TK2MSFTNGP04.phx.gbl...
> > If you would like one of these object use the following command.
> >
> > $Reg = [WMIClass]"root\default:StdRegProv"
> >
> > It is worth pointing out though, that this class has no instances. In fact
> > WMI does NOT represent registry keys or values as WMI objetcs. The way
> > that WMI accesses the registry is via the many methods associated with the
> > StdProv object. To see the many objects available try


My System SpecsSystem Spec
Old 11-10-2006   #10 (permalink)
Alex K. Angelopoulos [MVP]
Guest


 

Re: PowerShell and StdRegProv

Sure; here's what's happening. You want to take a look at the docs for
StdRegProv's EnumKey method, by the way:
http://msdn2.microsoft.com/en-us/library/aa390387.aspx

The variable you call $regkeys would be better named $resultcode. It's
non-zero, which indicates that your call failed. The problem is that you
didn't call EnumKey with the 3 parameters it requires.

<jonathan.prater@gmail.com> wrote in message
news:1163104460.270636.311870@b28g2000cwb.googlegroups.com...
> Here's a question for you...
> I run this in powershell on my computer:
> $regobj = [wmiclass]"root/default:stdregprov"
> $regobj now contains a class instance of StdRegProv. Now I need to
> pull keys for it. I tried this:
> $regkeys = $regobj.enumKey(2147483649, "software/microsoft")
> According to everything I can figure out, that should pull an array of
> all the subkeys in HKLM/Software/Microsoft into $regkeys. But this is
> what I get instead:
> PS > $regkeys | foreach { write-output $_ }
>
>
> __GENUS : 2
> __CLASS : __PARAMETERS
> __SUPERCLASS :
> __DYNASTY : __PARAMETERS
> __RELPATH :
> __PROPERTY_COUNT : 2
> __DERIVATION : {}
> __SERVER :
> __NAMESPACE :
> __PATH :
> ReturnValue : 2
> sNames :
>
> Thoughts?
>
> Alex K. Angelopoulos [MVP] wrote:
>> Sorry about not looking through this yesterday; I ran into the problem
>> myself earlier and used another approach that works:
>>
>> $Reg = Get-WmiObject -Namespace Root\Default -List | Where-Object
>> {$_.Name -eq "StdRegProv"}
>>
>> That was prior to RC 2 release; quite obviously, using [WMIClass] as you
>> do
>> is both more compact and more efficient.
>>
>>
>> "Brian McDermott" <brian.mcdermottNOSPAM@qa.com> wrote in message
>> news:eo4KNCh8GHA.1560@TK2MSFTNGP04.phx.gbl...
>> > If you would like one of these object use the following command.
>> >
>> > $Reg = [WMIClass]"root\default:StdRegProv"
>> >
>> > It is worth pointing out though, that this class has no instances. In
>> > fact
>> > WMI does NOT represent registry keys or values as WMI objetcs. The way
>> > that WMI accesses the registry is via the many methods associated with
>> > the
>> > StdProv object. To see the many objects available try

>



My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Installing PowerShell dependent features on W2K8 with PowerShell CTP Greg Wojan PowerShell 14 05-16-2008 08:15 AM
when run powershell script as windows service ,powershell fail powershell fail on winodws 2008 PowerShell 6 01-15-2008 03:20 PM
Powershell Plus - Free for non commercial Use and Powershell Analyzer1.0 released Karl Prosser[MVP] PowerShell 2 12-12-2007 12:43 PM
Automatic PowerShell Error Parsing in PowerShell Analyzer and PowerShellPlus Karl Prosser[MVP] PowerShell 0 11-14-2007 02:32 AM
PowerShell Leaders Join Forces and offer a pre-release version of PowerShell for 50% off the retail value klumsy@xtra.co.nz PowerShell 0 06-19-2007 02:42 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51