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.
>>
>>
>>