![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
|
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 | New to ps object piping Hi I am new to ps object piping and am just playing around. I am trying to modify some registry entries and wanted to be able to pipe all the registry item properties under a particular key through a where clause to the set-itemproperty cmdlet to modify the value. Below is the cmd. cd 'HKCU:\software\Policies\Microsoft\Internet Explorer\Control Panel' Get-ItemProperty 'HKCU:\software\Policies\Microsoft\Internet Explorer\Control Panel' | Get-Member | Where-Object {$_.name -like "Security*"} | Set-ItemProperty -name={$_.name} -value=1 The error I am getting is "Set-ItemProperty : A parameter cannot be found that matches parameter name 'name='." Any suggestions? I don't understand why the property is available on the object in the second stage of the pipe but then is not available in the third stage. Cheers, Adam. |
| | #2 (permalink) |
| Guest | RE: New to ps object piping "Adam Murray" wrote: > Hi I am new to ps object piping and am just playing around. > > I am trying to modify some registry entries and wanted to be able to pipe > all the registry item properties under a particular key through a where > clause to the set-itemproperty cmdlet to modify the value. Below is the cmd. > > cd 'HKCU:\software\Policies\Microsoft\Internet Explorer\Control Panel' > Get-ItemProperty 'HKCU:\software\Policies\Microsoft\Internet > Explorer\Control Panel' | Get-Member | Where-Object {$_.name -like > "Security*"} | Set-ItemProperty -name={$_.name} -value=1 > > The error I am getting is "Set-ItemProperty : A parameter cannot be found > that matches parameter name 'name='." > > Any suggestions? I don't understand why the property is available on the > object in the second stage of the pipe but then is not available in the > third stage. I'm impressed, for a beginner your syntax was almost perfect. ;-) I think this little modification will make it work: Set-Location 'HKCU:\software\Policies\Microsoft\Internet Explorer\Control Panel' Get-ItemProperty . | Get-Member | Where-Object {$_.name -like "Security*"} | ForEach-Object {Set-ItemProperty . -name $_.name -value 1} -- greetings dreeschkind > Cheers, > > Adam. > > > |
| | #3 (permalink) |
| Guest | Re: New to ps object piping Thanks Dreeschkind, Worked like a gem. I get confused about when I need to use the foreach loop. Cheers, Adam. "dreeschkind" <dreeschkind@discussions.microsoft.com> wrote in message news A4F646C-138C-4B58-804A-EB30967B9974@microsoft.com...> "Adam Murray" wrote: > >> Hi I am new to ps object piping and am just playing around. >> >> I am trying to modify some registry entries and wanted to be able to pipe >> all the registry item properties under a particular key through a where >> clause to the set-itemproperty cmdlet to modify the value. Below is the >> cmd. >> >> cd 'HKCU:\software\Policies\Microsoft\Internet Explorer\Control Panel' >> Get-ItemProperty 'HKCU:\software\Policies\Microsoft\Internet >> Explorer\Control Panel' | Get-Member | Where-Object {$_.name -like >> "Security*"} | Set-ItemProperty -name={$_.name} -value=1 >> >> The error I am getting is "Set-ItemProperty : A parameter cannot be found >> that matches parameter name 'name='." >> >> Any suggestions? I don't understand why the property is available on the >> object in the second stage of the pipe but then is not available in the >> third stage. > > I'm impressed, for a beginner your syntax was almost perfect. ;-) > I think this little modification will make it work: > > Set-Location 'HKCU:\software\Policies\Microsoft\Internet Explorer\Control > Panel' > Get-ItemProperty . | Get-Member | Where-Object {$_.name -like "Security*"} > | > ForEach-Object {Set-ItemProperty . -name $_.name -value 1} > > -- > greetings > dreeschkind > >> Cheers, >> >> Adam. >> >> >> |
| |
| |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Piping dir to tree | Steven Smith | PowerShell | 2 | 05-14-2008 11:00 PM |
| What is the syntax for piping LiteralPath to Get-ChildItem | Bob Landau | PowerShell | 6 | 10-05-2007 10:59 PM |
| piping/redirect to file slow | Ben Schwehn | PowerShell | 10 | 09-19-2007 07:34 AM |
| All about piping | Marco Shaw | PowerShell | 2 | 11-20-2006 11:20 AM |
| Adding canonical aliases for Compare-Object, Measure-Object, New-Object | Alex K. Angelopoulos [MVP] | PowerShell | 2 | 05-26-2006 07:58 AM |