Powershell scripting issue

sword_9mm

Ars Legatus Legionis
27,268
Subscriptor
I posted this in the Windows sub-forum but not sure that was right so I'm re-posting here (Mod(s); please let me know if i'm in the wrong place).

I'm using a stupid little script to test another software and I guess I'm dumb.

Here's the code: Set-ItemProperty 'HKCU:\Control Panel\Colors' -Name Background -Value "116 164 2"

This turns the background to some ugly green color; IF typed in the powershell console. If I use the ISE or just notepad and create a .ps1 I get the lovely error: "Set-ItemProperty : A positional parameter cannot be found that accepts argument '' "

So I guess I'm missing something but I can't figure out why it works one way and not the other.

Ideas?
 

Entegy

Ars Legatus Legionis
18,256
Try specifying -Path

" or ' does not matter. " is used if you have variables filling in content in the string, ' is used for literal interpretation.

Although to be honest working the registry via PowerShell is frustrating enough that I even though I try to stick with PowerShell commands for everything, I still fall back on reg.exe in a PowerShell script.