Get-ItemProperty: toggle 0 to 1 or 1 to 0

Microsoft Windows
Post Reply
Arnold
Posts: 2
Joined: 2022-Feb-26, 9:50 am

Get-ItemProperty: toggle 0 to 1 or 1 to 0

Post by Arnold »

Hello

Pls, i need your Help:

This stuff is not work: :(

$value = (Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\RadioManagement\SystemRadioState").'(default)' # "0" ???? / or -name -value?
If ($value -eq 0){set-ItemProperty “1”}
Else {set-ItemProperty ”0”}

Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\RadioManagement\SystemRadioState").'(default)'
I get 0 !! desactive
How i get beak to 1 ??? Active

Many Thank
Arnold
User avatar
Simon Sheppard
Posts: 81
Joined: 2021-Jul-10, 7:46 pm
Contact:

Re: Get-ItemProperty: toggle 0 to 1 or 1 to 0

Post by Simon Sheppard »

In your set-ItemProperty, you need to give it the -path where you want to set the value.
Arnold
Posts: 2
Joined: 2022-Feb-26, 9:50 am

Re: Get-ItemProperty: toggle 0 to 1 or 1 to 0

Post by Arnold »

Sir, many thank for your reply

i have modify to:

cls


$value = (Get-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\RadioManagement\SystemRadioState") #'(default)' # "0" ???? / or -name -value?
If ($value -eq 0){(Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\RadioManagement\SystemRadioState"). '1'}
Else {(Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\RadioManagement\SystemRadioState"). ”0”}

This is also not work:
$value = (Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\RadioManagement\SystemRadioState"). "1"

I have to add -name?

Thanks
Arnold
User avatar
Simon Sheppard
Posts: 81
Joined: 2021-Jul-10, 7:46 pm
Contact:

Re: Get-ItemProperty: toggle 0 to 1 or 1 to 0

Post by Simon Sheppard »

you dont need those brackets within the set-itemproperty parameters

See the syntax here
https://ss64.com/ps/set-itemproperty.html
Post Reply