![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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.
br> br> |
| |||||||
![]() |
| | Thread Tools | Display Modes |
| | #1 (permalink) |
| 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 Specs![]() |
| | #2 (permalink) |
| 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 Specs![]() |
| | #3 (permalink) |
| 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 Specs![]() |
| | #4 (permalink) |
| 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 Specs![]() |
| | #5 (permalink) |
| 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 Specs![]() |
| | #6 (permalink) |
| 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 Specs![]() |
| | #7 (permalink) |
| 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 Specs![]() |
| | #8 (permalink) |
| 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 Specs![]() |
| | #9 (permalink) |
| 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 Specs![]() |
| | #10 (permalink) |
| 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 Specs![]() |
![]() |
| 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 |