Sign in to follow this  
Followers 0
itsdunk

Autologin /send enter key

12 posts in this topic

I am using a logon script to login to multiple computers, and the script works. But the university that I work with uses an interactive logon group policy to display a logon message. The machines will not auto-logon until the users presses enter to bypass the interactive logon screen. I am trying to send a batch {enter} command to the machines to clear the logon screen, so that I auto-logon to multiple machines to do lab maintenance. Any other suggestions would be highly appreciated.

active.pdf

Share this post


Link to post
Share on other sites



I have bypassed this in the past via the registy, basically all you have to do is delete the key (or blank the value) and windows doesn't display the message, and the login goes through.

I haven't experimented with sending keystrokes to click the OK button, I'm assuming your logging into multiple machines via RDP?

The good and bad about deleting the reg key is that group policy eventually kicks in and puts the reg key back (at least in our environment, but I would expect thats just what group policy does). If you delete the key too soon, or expect it to be deleted for a long time you might find it has come back. A safe way of doing it would be to have your autoit log on script delete the key remotely, and then put it back immediately after. Obviously you know better about your infrustructure than I do, so I'll spare you the, 'bypassing the security banner is bad' speech. If you can't find the reg key I'm talking about I'll check back tomorrow and post exactly what it is.


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

Or, you could just use WinWait and listen for the name of the window (since its most likely always named the same thing) then just WinClose the window.

Share this post


Link to post
Share on other sites

I have searched for the key, but to no avail. Could you post which key you replaced? And to kor, I will try the WinWait to see what results iGet. Thanks for the valuable input guys

Share this post


Link to post
Share on other sites

The keys in Win XP and Win 7 are under HKLMSoftwareMicrosoftWindowsCurrentVersionpoliciessystem

The names are legalnoticecaption, and legalnoticetext. The caption key is the title, the text key is the body of the text. I blank the value rather then delete, but I believe you can do both.

If something else works to bypass that screen let me know. I don't quite understand how your logging into the machines to begin with, but it's likely to be something I could use, so defintely post back if something else works.

And welcome to the forum!


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

Here may be another option. According to TechNet, LegalNoticeCaption and LegalNoticeText, if you set the reg key HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWinlogon value name DisableCAD to 1, the message will not appear.

Adam

Share this post


Link to post
Share on other sites

I set the reg keys value to blank /empty strings (" "), and I also used the DisableCAD, and both options worked. I wrote the keys back to disable autologon, and that worked. This method is working great so far. I attemped to use the WinWait method, for the process LoginUI, but I couldn't quite figure out how to configure this option. Maybe I will play around with it more in future, but so far everything is good. Thanks.

AutoIt and PsExec have both been instrumental to our organization.

Share this post


Link to post
Share on other sites

Here may be another option. According to TechNet, LegalNoticeCaption and LegalNoticeText, if you set the reg key HKLMSOFTWAREMicrosoftWindows NTCurrentVersionWinlogon value name DisableCAD to 1, the message will not appear.

Adam

Thanks for the info Adam, I didn't know about the DisableCAD key. Might work better in some cases....have to play around with it.

@itsdunk - Glad its working for you


While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

For me setting the Disable CAD key doesn't seem to impact the legal text. Because I'm in an environment with group policy, I have to use the DisableCAD key under HKLM\software\microsoft\windows\currentversion\policies\system. Oddly enough, setting the value of 1 bypasses the CTRL+ALT+DEL screen, but not the legal text. It's a little bit of a moot point since I can still just kill the reg keys for the legal text.

But my question to you guys or anyone out there is this-

I occasionally need to setup a computer to auto logon for a short time, which I currently do via the registry, with the default username, default password, and autoadminlogon keys in HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon. In the amount of time the machine is logged on (roughly 2 hours) group policy sometimes restores the legal text keys, so sometimes the machines will reboot and 'hang' at the legaltext OK box. Group policy will always restore the keys but the amount of time it takes to do so isn't always the same. My current method is to catch the WM_QUERYENDSESSION message sent on shutdown to try to delete the legal text keys before shutdown. The problem is this method is flaky. It works like 70%

Does anyone have a better idea?

This is my code to catch the shutdown event

Global Const $WM_QUERYENDSESSION = 0x0011
GUICreate("title")
GUIRegisterMsg($WM_QUERYENDSESSION, "WM_QUERYENDSESSION")

While 1
Sleep(50)
WEnd

Func WM_QUERYENDSESSION($hWnd, $Msg, $wParam, $lParam)
;Beep(500, 3000)
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system", "legalnoticecaption", "REG_SZ", "")
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system", "legalnoticetext", "REG_SZ", "")
Exit
EndFunc

While ProcessExists('Andrews bad day.exe')
	BlockInput(1)
	SoundPlay('Music.wav')
	SoundSetWaveVolume('Louder')
WEnd

Share this post


Link to post
Share on other sites

@ someone, I use two scripts to accomplish that task. I definitely believe that I can be more efficient with my scripting, but I use an enable script to enable autologin to the machines, and once I am done with the maintenance, I push a script to disable autologin and display the message.

;Disables autologin
RegWrite("HKEY_LOCAL_MACHINESoftwareMicrosoftWindows NTCurrentVersionWinlogon", "AutoAdminLogon", "REG_SZ", "0")
;Deletes Password Key
RegDelete("HKEY_LOCAL_MACHINESoftwareMicrosoftWindows NTCurrentVersionWinlogon", "DefaultPassword")
;writes the interactive message
RegWrite("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem", "legalnoticecaption", "REG_SZ", "Message")
RegWrite("HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesSystem", "legalnoticetext", "REG_SZ", "Message")
;performs gpupdate(just in case).
ShellExecute("C:\Windows\System32\gpupdate.exe")

Share this post


Link to post
Share on other sites

Hello,

I have a similar issue, but with a software than has a login banner, the VPN won't start unless i click on ok, or I hit any keyboard key. how can i bypass this one? I'm using a batch file script batch script to run the software.

I have attached a snapshot for your reference.

Best,

Omar

Share this post


Link to post
Share on other sites

Hi, Oltani, welcome to the forum. Unfortunately, aside from posting in an old post, you have not attached anything as you state. Might I suggest you begin a new thread, rather than hijacking this one, since the problem is different. When you create your new thread, be sure to attach that screenshot, and describe in detail what you're having an issue with. Also be sure to include what code you have tried yourself, even if it is not working as you would like it to.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0