Hello again, I'm on to my next task in the automation of our company's system deployments. I am working on disabling the logon banner for Windows 7. This is pushed via GPO to each machine on the domain, and is stored under the following registry keys...
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
There are 2 values "legalnoticecaption" and "legalnoticetext" that I need to set to blank or 0 values. I have tried all the different iterations of a script to accomplish this. I've included the 2 versions of script that I have attempted against this issue which I still have. Can someone please point me in the right direction on why my entries are not being removed from the registry when I run the scripts. Neither of the below scripts are working. I can not change anything with the GPO object itself to achieve my desired result; which is for only a temporary disablement of the logon banner in Windows during a scripted install that needs multiple reboots. The plan is to have this script run right before each reboot to remove the banner, and trigger the reboot. Then at the end of the entire process it will run a "gpupdate /force" to pull the domain policy again & restore the logon banner before the first user uses their system.
Script 1:
--------
Const HKLM = &H80000002
strComputer = "."
Set oRej=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
strValueName1 = "legalnoticecaption"
strValueName2 = "legalnoticetext"
strValue = ""
oRej.SetStringValue HKLM, strKeyPath, strValueName1, strValue
oRej.SetStringValue HKLM, strKeyPath, strValueName2, strValue
Script 2:
--------
Const HKLM = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
strExpandedStringValueName = "legalnoticecaption"
oReg.DeleteValue HKLM, strKeyPath, strExpandedStringValueName
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System
There are 2 values "legalnoticecaption" and "legalnoticetext" that I need to set to blank or 0 values. I have tried all the different iterations of a script to accomplish this. I've included the 2 versions of script that I have attempted against this issue which I still have. Can someone please point me in the right direction on why my entries are not being removed from the registry when I run the scripts. Neither of the below scripts are working. I can not change anything with the GPO object itself to achieve my desired result; which is for only a temporary disablement of the logon banner in Windows during a scripted install that needs multiple reboots. The plan is to have this script run right before each reboot to remove the banner, and trigger the reboot. Then at the end of the entire process it will run a "gpupdate /force" to pull the domain policy again & restore the logon banner before the first user uses their system.
Script 1:
--------
Const HKLM = &H80000002
strComputer = "."
Set oRej=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
strValueName1 = "legalnoticecaption"
strValueName2 = "legalnoticetext"
strValue = ""
oRej.SetStringValue HKLM, strKeyPath, strValueName1, strValue
oRej.SetStringValue HKLM, strKeyPath, strValueName2, strValue
Script 2:
--------
Const HKLM = &H80000002
strComputer = "."
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System"
strExpandedStringValueName = "legalnoticecaption"
oReg.DeleteValue HKLM, strKeyPath, strExpandedStringValueName