Topic: Logon as Admin - AutoLogin (without command window showing)  (Read 512 times)

0 Members and 1 Guest are viewing this topic.

Logon as Admin - AutoLogin (without command window showing)
« on: October 15, 2017, 05:32:00 PM »

bob.omb

  • Chef
  • ***
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 159
For those who wish to have Administrator account auto-login (without the command window), replace your SwitchToAdmin.ini with the attached file.

It is a combination of exact(current as of 1709 -10/15/17),  SwitchToAdmin.ini, and SwitchToAdminPrepare.ini, and it bypasses SwitchToAdmin.cmd

Shortcut, Text-on-Top, and username,options will still function as usual, but countdown options will no longer work because it will automitaclly log in!  :wink:  I would love for this to be an option (checkbox) for LogonAsAdmin plugin but until then we can use this.  :great:

Shown in codebox and attached as 7z:
Code: [Select]
////////////////////////////////////////
//   Switch to Administrator Auto  //
////////////////////////////////////////

LOGS %WinDir%\System32\SwitchToAdmin.log

CALL OSInit
CALL PreShell
CALL workgroup
CALL RenameAdmin
CALL Registry
CALL Services
// KillExplorer only for Shortcuts, explorer is not loaded with Auto-Logon
//CALL KillExplorer
CALL OpenSystemMenucmd
CALL Disconnect

////////////////////////////////////////////////////////////////////////////////////////////////
_SUB OSInit

LOGO %WinDir%\web\wallpaper\Windows\img0.jpg
TEXT System configuration, Please Wait...#0xFFFFFF L59 T39 $20*
// TIPS  System configuration, Please Wait..,,1,#1

_END
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB PreShell

// Mount media USB, ISO to drive Y: Hide Wait
EXEC !=%WinDir%\system32\MountPEmedia.exe

// Fix display screen problems and Show Desktop. Run it once before changing the screen resolution or load a graphic driver.
EXEC %SystemRoot%\system32\FixScreen.exe

//DEVI %WinDir%\inf\xxxxx.inf

// Install external drivers, load external program
LOAD Y:\PecmdExt.ini
INIT IU,3000

_END
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB workgroup

// Join a workgroup WORKGROUP, use startnet.exe from PENetwork, to get some network support.
// We must first join the working group, otherwise Administrator can not log in
TIPS  Switch to administrator, set up workgroup......,,1,#1
EXEC != startnet.exe -wg WORKGROUP

_END
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB RenameAdmin

// EXEC  = Wait, @background, ! Hide. ex: EXEC =WaitNoHide.cmd, EXEC @!=WaitHide.cmd, EXEC NoWaitNoHide.cmd, EXEC @!NoWaitHide.cmd
// Rename localized Administrator account to Admin
EXEC != secedit.exe /configure /db %WinDir%\security\database\unattend.sdb /cfg %WinDir%\security\templates\unattend.inf /log %WinDir%\security\logs\unattend.log

_END
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB Registry

// Disable sihost.exe to speed up the logon. Already done at build time
//REGI HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\EnableSIHostIntegration=#0

// Administrator user logs automatically
TIPS  Switch to an administrator, set up automatic login......,,1,#1
REGI HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon=#1
REGI HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName=Administrator
REGI HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword=""
REGI HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName=WORKGROUP

// GUEST do not need to use the login screen
REGI HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\SpecialAccounts\UserList\Guest=#0

// Launch Pecmd SwitchToAdminLogon.ini after logon as As Admin
REGI HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce\Init=PECMD.EXE Main %WinDir%\System32\SwitchToAdminLogon.ini

_END
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB Services

TIPS  Start the service to switch to administrator, ......,,1,#1
EXEC !=sc start gpsvc
EXEC !=sc start ProfSvc
EXEC !=sc start seclogon
EXEC !=sc start ShellHWDetection

_END
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB KillExplorer

//TIPS  Switch to Administrator, disconnect current user......,,1,#1

// Existing current users and automatically switch to Administrator with log enabled, it will automatically execute Pecmd admin.ini
// Kill explorer is not necessary for Auto-Logon but required for Switch to Admin shortcuts
KILL Explorer
KILL *Explorer

_END
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB OpenSystemMenucmd

// Auto-Login
EXEC !=PECMD.EXE Main %WinDir%\System32\SwitchToAdminLogon.ini

_END
////////////////////////////////////////////////////////////////////////////////////////////////
_SUB Disconnect

EXEC !%WinDir%\System32\tsdiscon.exe

_END
////////////////////////////////////////////////////////////////////////////////////////////////

« Last Edit: October 17, 2017, 03:05:32 PM by bob.omb »

Re: Logon as Admin - AutoLogin
« Reply #1 on: October 17, 2017, 09:54:33 AM »

ChrisR

  • Moderator, Win7PE SE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 2911
That's OK however it can also be done, ~the same, by setting the count down to 0 in the plugin.

Re: Logon as Admin - AutoLogin
« Reply #2 on: October 17, 2017, 10:11:14 AM »

bob.omb

  • Chef
  • ***
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 159
It did not produce the same result for me. When I select 0 from timer, when booting, a command window pops up and sits there for a second or two.  When I do it the way described above no command window appears and is seamless.  The way above looks a bit cleaner, I am super grateful for the plugin to begin with, just trying to help with snips for anyone trying to get that result. 
« Last Edit: October 17, 2017, 10:18:19 AM by bob.omb »

Re: Logon as Admin - AutoLogin
« Reply #3 on: October 17, 2017, 10:25:35 AM »

ChrisR

  • Moderator, Win7PE SE Baker
  • Grand Chef
  • *****
  • Date Registered: Mar 2011
  • Posts: 2911
Indeed, the command window is displayed with the message "Loading the Administrator session..."
but otherwise it is exactly the same process. So, there is no real need for an additional option.
Of course, there is no worries to use your pecmd ini.

About the Administrator, I still do not really see a real bonus on my side vs the System account.
They both have power rights but not the sames.
Let me know if you have things, apps (TeamViewer) that works with the Administator and not with the System user.
« Last Edit: October 17, 2017, 10:38:51 AM by ChrisR »

Re: Logon as Admin - AutoLogin (without command window showing)
« Reply #4 on: October 17, 2017, 03:44:28 PM »

bob.omb

  • Chef
  • ***
  • Location: USA
  • Date Registered: Jul 2017
  • Posts: 159
I will put a list together by tomorrow, was starting to post here, but want to make sure first. ****but Teamviewer alone is worth it.

Been very busy with build and work.  Will still test this, finishing next build then on to Admin account testing!
« Last Edit: October 24, 2017, 10:46:55 AM by bob.omb »

 

Powered by EzPortal