Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Log On After Reboot


1 reply to this topic

tlukareski

tlukareski
  • Members
  • 4 posts

Posted 07 May 2002 - 17:51

Hello-

I need to know if there is a way to automatically log on to a machine after a reboot?  

I would like to log on to all workstations that run my installation as administrator (the password is the same for all machines) after the machine reboots.  I would like the log on to be as silent as possible.

Any suggestions would be greatly appreciated?

Thanks-
Thomas

Marie Tupps

Marie Tupps
  • Members
  • 22 posts

Posted 08 May 2002 - 13:24

Thomas

There sure is, I use it quite often.  The first thing I do is Get the users system login id and password, then update the registry entry.  I eventually will reset the entry after the installation has completed(optional).  The code I use is below.

Best of luck
Marie

Code Sample

Dlg_SysLogin:
   szTitle = "System Login";
   szMsg = "Please enter the system password for " +   szCurrentUser + ".";
   svEdit1= szCurrentUser;
 
   nResult=SdShowDlgEdit2 ( szTitle, szMsg, "UserName", "Password", svEdit1, svEdit2 );
   Disable(BACKBUTTON);
   if(nResult=CANCEL) then
     bInstallAborted=TRUE;
     Disable(STATUSEX);
     Disable(DIALOGCACHE);
     bInstallAborted=TRUE;
     ConfirmCancel();
   elseif(nResult = BACK) then
     goto Dlg_SetupType;
   else  
     Disable(LOGGING);
     szAutoID = svEdit1;
     if(svEdit1 = "") then
       MessageBox("User must enter System Login, this field cannot be left blank!",WARNING);
       szAutoID= "";
       goto Dlg_SysLogin;
     endif;
     szAutoPwd = svEdit2;                      
     
//create tge registry entry:
RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
szKey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon";
nRegType = REGDB_STRING;
nResult = RegDBSetKeyValueEx(szKey, "AutoAdminLogon", nRegType, "1", nvSize);
nResult = RegDBSetKeyValueEx(szKey, "DefaultPassword", nRegType, svEdit2,nvSize);
 
**********************************************
OnEnd()

//delete/reset the autologin (optional)
RegDBSetDefaultRoot( HKEY_LOCAL_MACHINE );
nRegType = REGDB_STRING;
szKey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\WinLogon";
nResult = RegDBSetKeyValueEx(szKey, "AutoAdminLogon", nRegType, "0", nvSize);
     
nResult =RegDBDeleteValue(szKey, "DefaultPassword");

Marie Tupps