Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Tuesday, April 12, 2011 3:19 PM
I am new to powershell. This is a very simple question.
I need to set a regsitry value. In the key that already on the system.
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background
a dword=1
Thank you.
All replies (7)
Tuesday, April 12, 2011 3:53 PM âś…Answered
New-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background -Name OEMBackground -Value 1 -PropertyType Dword
Tuesday, April 12, 2011 3:25 PM
Set-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background -Name OEMBackground -Value 1
Tuesday, April 12, 2011 3:50 PM
Thanks for the quick help. But that sets a String Value. I need a dword.
Tuesday, April 12, 2011 3:56 PM | 1 vote
try this:
Set-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background -Name OEMBackground -Value 1 -type dword
regards Thomas Paetzold visit my blog on: http://sus42.wordpress.com
Tuesday, April 12, 2011 4:09 PM
Thank you. That worked.
Another question. If value already set "which will not be the case" the script will fail with "The property already exists"
Is there a way to ingore or replace the existing value?
Thank you.
Tuesday, April 12, 2011 4:27 PM
$value = (Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background).OEMBackground
if ($value -eq 0)
{
New-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Authentication\LogonUI\Background -Name OEMBackground -Value 1 -PropertyType Dword -Force
}
else {"Ignore"}
or use command by Peddy1st.
Tuesday, April 12, 2011 4:36 PM
If it already has a dword value this script will ingore and exit. However if there is no value it sets a string instead of a dword?
Thanks for the help.