Editing Registry

I thought the pipe was part of the problem. Thanks for confirming my suspicion.

Since I am so new at this, the carriage return makes it much easier to read. However, the semicolons will come in handy eventually. Thanks for the tip!

While I have your attention, I have moved on to my next obstacle… I need to modify an existing registry key value. Below is what I am using…

 New-Item -Path HKLM:\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order -Name ProviderOrder -Value "PnSson,RDPNP.LanmanWorkstation,webclient" -Force 

the -Name argument keeps adding a new key under “Order” instead of updating the existing sub-key (see attached ‘Reg_ProviderOrder.jpg’). Based on what I have read, this isn’t what should happen. I want it to modify the existing sub-key that is highlighted in the second attachment (‘Reg_ProviderOrder_02.jpg’). I will keep digging however, if you have any ideas…

You don’t have “sub-keys” in PowerShell.

You have items, which have item properties. In RegEdit, an “item” is a folder; what appears on the right-hand pane are “Item Properties.”

Get-Command -Noun ItemProp*

You should also be able to run “Help Registry” to get help on the Registry PSProvider, which includes a lot of useful registry-specific examples.

$computer = 'MyPC'
$reg = [Microsoft.Win32.RegistryKey]::OpenRemoteBaseKey['LocalMachine',$computer]
$key = $reg.OpenSubKey['SYSTEM\CurrentControlSet\Control\NetworkProvider\Order', $true]
$key.SetValue['ProviderOrder', 'PnSson,RDPNP.LanmanWorkstation,webclient', 'String']
$key.Close[]
$key.Dispose[]
$reg.Close[]
$reg.Dispose[]

Not sure how to stop it from adding when it should be ()