Legal Notice box blocking automatic logon

  • Thread starter Thread starter Marc Brenowitz
  • Start date Start date
M

Marc Brenowitz

For a project at work, I've set up a Windows 2000
workstation to automatically reboot and logon. I used
Task Scheduler to run a VB script to perform the reboot.
I set up the registry key
HKEY_LOCAL_MACHIN\SOFTWARE\Microsoft\WindowsNT\CurrentVersi
on\Winlogon\AutoAdminLogon to a value of 1. This means
after the reboot the logon name and password fields are
automatically populated.
The problem is that there is a Legal Notice dialogue box
that appears after ctrl-alt-del, but before the Logon to
Windows dialogue box. However, the registry keys that
should be populated in order to create the Legal Notice
box, LegalNoticeText and LegalNoticeCaption, are blank.
The Legal Notice box requires a key press of enter in
order to go to the Logon to Windows box. Once enter is
pushed at Legal Notice, the system automatically logs on.
Is there any way using the registry to go around the Legal
Notice box, or to treat it as having Enter pushed?
I have tried used a VB script with SendText, and launching
it through Group Policy, startup, but that hasn't worked.
I am not proficient at VBS, but I was able to find some
scripts and commands to use for this project.
Thanks,
Marc
 
Very well could be a permissions problem. Give the logon local admin rights
to test.

Does the subkey and values exist on this machine? IIRC Windows NT puts them
in
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon
 
Dave,
The keys from your script do indeed exist on the machine.
The error message occurs when logging out from the admin
login, so it can't be a permissions issue.
I did try modifying your script to use the keys under
Windows NT\CurrentVersion\Winlogon, and received the same
error message. It is strange to me that the script works,
but generates an error message that requires enter to be
pressed to cancel.
Would it be possible to add the following to your script
in order to just press enter after the error message?

Set objShell = WScript.CreateObject("WScript.Shell")
Wscript.Sleep 5000
objShell.SendKeys "{ENTER}"

If you can't perform two actions like this in one script,
would it be possible to use two scripts, and to string
them one after the other?

You cautioned about word wrap in your notes about your
script. The error message mentions line 3, char 1.
Should there be a space at the beginning of line 3, or
another character, to prevent that error?
Dave, you have been a terrific help with this problem, and
with helping me to start to understand scripts.
Thanks so much,
Marc
-----Original Message-----
Very well could be a permissions problem. Give the logon local admin rights
to test.

Does the subkey and values exist on this machine? IIRC Windows NT puts them
in
HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft MVP [Windows NT/2000 Operating Systems]

Marc Brenowitz said:
Dave,
I tried this, and it works great from the administrative
login. I can get the reboot and your script allows the
automatic logon to run. However, when I test the whole
setup, Task scheduler runs my reboot vbs script, automatic
logon is setup in the registry, and your script to get
past the legal notice dialogue box, at logoff, the
following error shows:
Script [script path]
Line 3
Char 1
invalid root in registry key
HKLM\SOFTWARE\Microsoft\Windows\currentversion\policies\sys
tem\legalnoticecaption
Code 80070005
Source WshShell.RegRead

At this point, enter has to be pressed to get around the
error message, and then the script runs.

Is this a permissions issue? The logon that the automatic
logon triggers does not have admin rights. Or is this a
simple path issue? I've read over the path and I can't
see a problem, and the script does work.
Thanks so much,
Marc


.
 
IMO sendkeys is neither predicable nor reliable. It works fine here. Try
scheduling this one. Just remove the line numbers.

----------------------------------
1 Dim WshShell
2 Set WshShell=WScript.CreateObject("WScript.Shell")
3 WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\" _
4 & "CurrentVersion\policies\system\legalnoticecaption", "", "REG_SZ"
5 WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\" _
6 & "CurrentVersion\policies\system\legalnoticetext", "", "REG_SZ"
7 Set WshShell=Nothing
8 Set objWMIService = GetObject("winmgmts:" _
9 & "{impersonationLevel=impersonate,(Shutdown)}!\\.\root\cimv2")
10 Set colOperatingSystems = objWMIService.ExecQuery _
11 ("Select * from Win32_OperatingSystem")
12 For Each objOperatingSystem in colOperatingSystems
13 ObjOperatingSystem.Reboot()
14 Next
 
Dave,
Scheduled that script with task scheduler.
As soon as the script runs, it generates the same error as
before:
Script [script path]
Line 3
Char 1
invalid root in registry key
HKLM\SOFTWARE\Microsoft\Windows\currentversion\policies\sys
tem\legalnoticecaption
Code 80070005
Source WshShell.RegRead

I checked a reference book on VBS and one thing only
occurred to me: that RegRead can't read the \ character.
Not sure why this is sticking at the start of line 3, at
WshShell.RegWrite, but it does it consistently. Could
something in a group policy or security template counter
RegWrite? Those can't, from what I know.
Also, if I change the location string to reflect WindowsNT
logon instead of policies\system, the same error comes
up. So the problem seems to be with the WshShell.RegWrite
command?
Thanks again for all of your help so far, and any further
suggestions would be greatly appreciated.
Marc
-----Original Message-----
IMO sendkeys is neither predicable nor reliable. It works fine here. Try
scheduling this one. Just remove the line numbers.

----------------------------------
1 Dim WshShell
2 Set WshShell=WScript.CreateObject("WScript.Shell")
3 WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\" _
4
& "CurrentVersion\policies\system\legalnoticecaption", "",
"REG_SZ"
5 WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\" _
6
& "CurrentVersion\policies\system\legalnoticetext", "", "RE
G_SZ"
7 Set WshShell=Nothing
8 Set objWMIService = GetObject("winmgmts:" _
9 & "{impersonationLevel=impersonate,(Shutdown)}! \\.\root\cimv2")
10 Set colOperatingSystems = objWMIService.ExecQuery _
11 ("Select * from Win32_OperatingSystem")
12 For Each objOperatingSystem in colOperatingSystems
13 ObjOperatingSystem.Reboot()
14 Next
----------------------------------

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft MVP [Windows NT/2000 Operating Systems]

Marc Brenowitz said:
Dave,
The keys from your script do indeed exist on the machine.
The error message occurs when logging out from the admin
login, so it can't be a permissions issue.
I did try modifying your script to use the keys under
Windows NT\CurrentVersion\Winlogon, and received the same
error message. It is strange to me that the script works,
but generates an error message that requires enter to be
pressed to cancel.
Would it be possible to add the following to your script
in order to just press enter after the error message?

Set objShell = WScript.CreateObject("WScript.Shell")
Wscript.Sleep 5000
objShell.SendKeys "{ENTER}"

If you can't perform two actions like this in one script,
would it be possible to use two scripts, and to string
them one after the other?

You cautioned about word wrap in your notes about your
script. The error message mentions line 3, char 1.
Should there be a space at the beginning of line 3, or
another character, to prevent that error?
Dave, you have been a terrific help with this problem, and
with helping me to start to understand scripts.
Thanks so much,
Marc


.
 
I did some checking into the error message. 80070005 is
used by Microsoft in a variety of programming (including
various VB)as a general access denied error message, so
this is a permissions issue in writing to the registry.
I have tried used On Error Enter Next, but that doesn't go
around the permissions issue.
Any ideas? I'm about to tell my boss that without domain
admin access, we can't automate this, as it won't work
with local admin access, either. Weird.
Marc
-----Original Message-----
Dave,
Scheduled that script with task scheduler.
As soon as the script runs, it generates the same error as
before:
Script [script path]
Line 3
Char 1
invalid root in registry key
HKLM\SOFTWARE\Microsoft\Windows\currentversion\policies\sy s
tem\legalnoticecaption
Code 80070005
Source WshShell.RegRead

I checked a reference book on VBS and one thing only
occurred to me: that RegRead can't read the \ character.
Not sure why this is sticking at the start of line 3, at
WshShell.RegWrite, but it does it consistently. Could
something in a group policy or security template counter
RegWrite? Those can't, from what I know.
Also, if I change the location string to reflect WindowsNT
logon instead of policies\system, the same error comes
up. So the problem seems to be with the WshShell.RegWrite
command?
Thanks again for all of your help so far, and any further
suggestions would be greatly appreciated.
Marc
-----Original Message-----
IMO sendkeys is neither predicable nor reliable. It
works
fine here. Try
scheduling this one. Just remove the line numbers.

----------------------------------
1 Dim WshShell
2 Set WshShell=WScript.CreateObject("WScript.Shell")
3 WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\" _
4
& "CurrentVersion\policies\system\legalnoticecaption", "",
"REG_SZ"
5 WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows\" _
6
& "CurrentVersion\policies\system\legalnoticetext", "", "R E
G_SZ"
7 Set WshShell=Nothing
8 Set objWMIService = GetObject("winmgmts:" _
9 & "{impersonationLevel=impersonate,(Shutdown)}! \\.\root\cimv2")
10 Set colOperatingSystems = objWMIService.ExecQuery _
11 ("Select * from Win32_OperatingSystem")
12 For Each objOperatingSystem in colOperatingSystems
13 ObjOperatingSystem.Reboot()
14 Next
----------------------------------

--
Regards,

Dave Patrick ....Please no email replies - reply in newsgroup.
Microsoft MVP [Windows NT/2000 Operating Systems]

Marc Brenowitz said:
Dave,
The keys from your script do indeed exist on the machine.
The error message occurs when logging out from the admin
login, so it can't be a permissions issue.
I did try modifying your script to use the keys under
Windows NT\CurrentVersion\Winlogon, and received the same
error message. It is strange to me that the script works,
but generates an error message that requires enter to be
pressed to cancel.
Would it be possible to add the following to your script
in order to just press enter after the error message?

Set objShell = WScript.CreateObject("WScript.Shell")
Wscript.Sleep 5000
objShell.SendKeys "{ENTER}"

If you can't perform two actions like this in one script,
would it be possible to use two scripts, and to string
them one after the other?

You cautioned about word wrap in your notes about your
script. The error message mentions line 3, char 1.
Should there be a space at the beginning of line 3, or
another character, to prevent that error?
Dave, you have been a terrific help with this problem, and
with helping me to start to understand scripts.
Thanks so much,
Marc


.
.
 
Like I said it works fine here. Try another user profile, another machine,
etc. A domain administrators account wouldn't have anything to do with it
(unless it's on a PDC)
 
Another option is to create this *.reg file. And again use the policy
editor;
Use the Group policy editor
%windir%\system32\gpedit.msc
User Config\Windows Settings\Scripts\Logoff

with a command line something like
regedit /s <filename.reg>

-------------
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\syste
m]
"legalnoticecaption"=""
"legalnoticetext"=""
 
Back
Top