Welcome, Guest. Please login or register.

Author Topic: Auto logon/logoff software  (Read 2128 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline adzTopic starter

  • Knight of the Sock
  • Hero Member
  • *****
  • Join Date: Aug 2003
  • Posts: 2961
    • Show only replies by adz
Auto logon/logoff software
« on: March 23, 2004, 02:36:37 AM »
Hi all

Just wondering if any of you guys had come across a program (for Windows 2K/XP) that will, once the system is turned on, automatically log a user on at a specified time and then automatically log them off at a specified time to log another user on? And then at the end of the day automatically shut the machine down. I'm not even sure if something like this exists, but I have been asked to look into it. Any advice or clues would be greatly appreciated. Thanks in advance.

Adz
 

Offline blobrana

  • Hero Member
  • *****
  • Join Date: Mar 2002
  • Posts: 4743
    • Show only replies by blobrana
    • http://mysite.wanadoo-members.co.uk/blobrana/home.html
Re: Auto login/logoff software
« Reply #1 on: March 23, 2004, 04:39:17 AM »
Stay clear of auto log on programs, i say...
Open to abuse, and best not to keep passwords on the machine...http://www.winguides.com/registry/display.php/13/
But windows scheduler will auto update and defrag etc....

As for auto shut-down try these programs...
http://www.tucows.com/shutdown95_default.html


Offline NightShade737

  • Sr. Member
  • ****
  • Join Date: May 2003
  • Posts: 328
    • Show only replies by NightShade737
    • http://atomnet.co.uk
Re: Auto login/logoff software
« Reply #2 on: March 23, 2004, 08:54:40 AM »
You can use TweakXP to Auto-Log on, just enter the details in there and it automatically changed the Registry so the machine logs on, you can manually edit the registry so the machine logs itself on,  but I can't remember exactly how to.
 

Offline adzTopic starter

  • Knight of the Sock
  • Hero Member
  • *****
  • Join Date: Aug 2003
  • Posts: 2961
    • Show only replies by adz
Re: Auto logon/logoff software
« Reply #3 on: March 23, 2004, 09:09:54 AM »
Thanks guys, we currently use tweakui to log classroom workstations on already, we were hoping to have the lab machines set up to log on at a scheduled time for a particular class and then auto log off and log on for the next class. I've heard of it being done, but no one I know has tried it. Personally I think it will cause more headaches for me and my techs but when it comes from the top, you have to at least try.
 

Offline jonssonj

  • Sr. Member
  • ****
  • Join Date: Oct 2003
  • Posts: 251
    • Show only replies by jonssonj
Re: Auto logon/logoff software
« Reply #4 on: March 23, 2004, 11:42:28 AM »
Hello!

The logon information is here.

HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/WindowsNT/CurrentVersion/WinLogon

If you want the machine to log on, here should be the following string values:

AutoAdminLogon = 1
DefaultDomainName = Your domain name or the computer name
DefaultUserName = the username the computer will login with
DefaultPassword = the usernames password

Here follows a VBScript that can change these registry values. You have to change the domainname, username and password in the script, in the function SetAutoLogon.

If you change the SetAutoLogon function, so it accepts input parameters, you could use this script in the scheduling tasks in Windows XP.

=============================================================
  Option Explicit

'******************************************************************
'*   Constants
'******************************************************************

  const KEY_QUERY_VALUE    = &H0001
  const KEY_SET_VALUE      = &H0002
  const KEY_CREATE_SUB_KEY = &H0004
  const DELETE             = &H00010000

  Const HKEY_CLASSES_ROOT  = &H80000000
  Const HKEY_CURRENT_USER  = &H80000001
  Const HKEY_LOCAL_MACHINE = &H80000002
  Const HKEY_USERS         = &H80000003

  Const JOIN_DOMAIN             = 1
  Const ACCT_CREATE             = 2
  Const ACCT_DELETE             = 4
  Const WIN9X_UPGRADE           = 16
  Const DOMAIN_JOIN_IF_JOINED   = 32
  Const JOIN_UNSECURE           = 64
  Const MACHINE_PASSWORD_PASSED = 128
  Const DEFERRED_SPN_SET        = 256
  Const INSTALL_INVOCATION      = 262144

 
'******************************************************************
'*   Global Variables
'******************************************************************
 
  Dim strReturnValue
  Dim ReturnValue
  Dim strDomain
  Dim strUser
  Dim strPassword
  Dim objNetwork
  Dim strComputer
  Dim objComputer

'******************************************************************  
'  Wscript.Echo "The Begining"
'******************************************************************

'******************************************************************
'* Create A registry key
'******************************************************************  
  'Example of using the CreateARegistryKey and SetARegistryKey
  strReturnValue = CreateARegistryKey("SOFTWARE\BBB\BB")
  strReturnValue = SetARegistryKey("SOFTWARE\BBB\BB","Ready" ,"1")
 
  If (strReturnValue <> "-1") Then
   ' Wscript.Echo "Ready Flag = " & strReturnValue
   '******************************************************************
   '* Script Code
   '******************************************************************
   ' Wscript.Echo "The Script Begins" & vbTab & Now & vbNewLine
   '******************************************************************  

   'Get the computer name. We need this for the reboot function.
   Set objNetwork = CreateObject("WScript.Network")
   strComputer = objNetwork.ComputerName

   'Here we change the registry, to the right user that will be automatically
   'logged in.
   strReturnValue = SetAutoLogon
   If (strReturnValue <> "-1") Then
      ' Wscript.Echo "Setting Atuologon successed"
   Else
      Wscript.Echo "Error Setting Autologon in the registry = " & strReturnValue
   End If

'**********************************************************************
'*  RebootComputer      
'**********************************************************************    
  ReturnValue = RebootComputer(strComputer)
  if ReturnValue <> 0 Then
    Wscript.Quit -6
  End If
   
'******************************************************************  
' Wscript.Echo "The End"
'******************************************************************  

'**********************************************************************
'*    NAME:        CreateARegistryKey
'*    FUNCTION:   
'**********************************************************************
Function CreateARegistryKey(strKeyPath)
  Dim oReg
  Dim sReturn
 
  On Error Resume Next
 
    Set oReg = GetObject("winmgmts://./root/default:StdRegProv")    
   
    sReturn = oReg.CreateKey(HKEY_LOCAL_MACHINE,strKeyPath)
 
    Set oReg = Nothing
   
  If Err <> 0 then
    '* Wscript.Echo Err.Source & " " & Hex(Err) & ": " & Err.Description & "Error # " & CStr(Err.Number)
    Err.Clear
    CreateARegistryKey = "-1" 'Error
  Else
    CreateARegistryKey = "0" 'OK
  End If  
End Function

'**********************************************************************
'*    NAME:        SetARegistryKey
'*    FUNCTION:   
'**********************************************************************
Function SetARegistryKey(strKeyPath ,strKey ,strKeyValue)
  Dim oReg
  Dim sReturn
 
  On Error Resume Next
 
    Set oReg = GetObject("winmgmts://./root/default:StdRegProv")        
   
    sReturn = oReg.SetStringValue (HKEY_LOCAL_MACHINE,strKeyPath,strKey,strKeyValue)
   
    Set oReg = Nothing
   
  If Err <> 0 then
    '* Wscript.Echo Err.Source & " " & Hex(Err) & ": " & Err.Description & "Error # " & CStr(Err.Number)
    Err.Clear
    SetARegistryKey = "-1" 'Error
  Else
    SetARegistryKey = "0"
  End If
End Function


'**********************************************************************
'*    NAME:        GetARegistryKey
'*    FUNCTION:   
'**********************************************************************
Function GetARegistryKey(strKeyPath, strKey)
  Dim oReg
  Dim strKeyValue
  Dim sReturn
 
  On Error Resume Next
 
    Set oReg = GetObject("winmgmts://./root/default:StdRegProv")
   
    sReturn = oReg.GetStringValue (HKEY_LOCAL_MACHINE,strKeyPath,strKey,strKeyValue)
 
    Set oReg = Nothing
   
  If Err <> 0 then
    '* Wscript.Echo Err.Source & " " & Hex(Err) & ": " & Err.Description & "Error # " & CStr(Err.Number)
    Err.Clear
    GetARegistryKey = "-1" 'Error
  Else
    GetARegistryKey = strKeyValue
  End If
End Function

'**********************************************************************
'*    NAME:        RebootComputer
'*    FUNCTION:   Reboot Computer Need the Computer Name as input
'**********************************************************************
Function RebootComputer(sComputer)
  Dim objWMIService
  Dim colOperatingSystems
  Dim objOperatingSystem
 
  On Error Resume Next
   
  Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate,(Shutdown)}!\\" & sComputer & "\root\cimv2")
   
  Set colOperatingSystems = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
   
  For Each objOperatingSystem in colOperatingSystems
    ObjOperatingSystem.Reboot()
  Next
 
  Set colOperatingSystems = Nothing
  Set objWMIService = Nothing
 
  If Err = 0 then
    RebootComputer = "0" 'OK
  Else
    Wscript.Echo Err.Source & " " & Hex(Err) & ": " & Err.Description & "Error # " & CStr(Err.Number)
    Err.Clear
    RebootComputer = "1" 'Error
  End If
End Function

'**********************************************************************
'*    NAME:        SetAutoLogon
'*    FUNCTION:   
'**********************************************************************
Function SetAutoLogon()

  strReturnValue = SetARegistryKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","AutoAdminLogon" ,"1")
 
  If (strReturnValue <> "-1") Then
'   Wscript.Echo "Ready Flag = " & strReturnValue
  Else
    Wscript.Echo "Error reading Ready Flag = " & strReturnValue
  End If

  strReturnValue = SetARegistryKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","DefaultDomainName" ,"DomainName")
 
  If (strReturnValue <> "-1") Then
'   Wscript.Echo "Ready Flag = " & strReturnValue
  Else
    Wscript.Echo "Error reading Ready Flag = " & strReturnValue
  End If

  strReturnValue = SetARegistryKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","DefaultUserName" ,"UserName")
 
  If (strReturnValue <> "-1") Then
'   Wscript.Echo "Ready Flag = " & strReturnValue
  Else
    Wscript.Echo "Error reading Ready Flag = " & strReturnValue
  End If

  strReturnValue = SetARegistryKey("SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon","DefaultPassword" ,"Password")
 
  If (strReturnValue <> "-1") Then
'   Wscript.Echo "Ready Flag = " & strReturnValue
  Else
    Wscript.Echo "Error reading Ready Flag = " & strReturnValue
  End If

  SetAutoLogon = strReturnValue

End Function

'******************************************************************
'*
'******************************************************************
==========================================================

Happy Coding and Good Luck!

/Jörgen Jönsson
 

Offline Cyberus

  • Hero Member
  • *****
  • Join Date: Feb 2003
  • Posts: 5696
    • Show only replies by Cyberus
Re: Auto logon/logoff software
« Reply #5 on: March 23, 2004, 02:26:37 PM »
I don't know if this is what you want or if its any good, but I noticed a piece of software called Roboform the other day. Available at download.com

Regards
I like Amigas
 

Offline adzTopic starter

  • Knight of the Sock
  • Hero Member
  • *****
  • Join Date: Aug 2003
  • Posts: 2961
    • Show only replies by adz
Re: Auto logon/logoff software
« Reply #6 on: March 23, 2004, 10:53:31 PM »
@jonssonj

Where did you get that code from?? Do you have a link?? I was thinking about scripting the process and running it with task scheduler but, 1. I didn't really know where to start, and 2. trying to administer it using task scheduler would be a nightmare. You've given me a place to start but now I am trying to figure out a way to centrally manage it, ie. create a script that runs on a DC and issues logon/logoff commands to a group of computers in a particular OU, guess I'm gonna have to dust off my thinking cap. Thanks for all that, much appreciated.
 

Offline adzTopic starter

  • Knight of the Sock
  • Hero Member
  • *****
  • Join Date: Aug 2003
  • Posts: 2961
    • Show only replies by adz
Re: Auto logon/logoff software
« Reply #7 on: March 23, 2004, 10:55:52 PM »
@Cyberus

Had a look at that prog and its actually a browser plugin for managing site passwords and forms, supposedly its secure, I  personally wouldn't trust it, thanks anyway.
 

Offline jonssonj

  • Sr. Member
  • ****
  • Join Date: Oct 2003
  • Posts: 251
    • Show only replies by jonssonj
Re: Auto logon/logoff software
« Reply #8 on: March 24, 2004, 11:25:17 AM »
I have done it myself. We use it here at my work. We ghosts a machine wholy automatic every night, with the symantec ghost console, and then we use a vb script to make the computer join our domain, and then we installs our daily builds on the machine and tests the installed programs.

/Jörgen
 

Offline adzTopic starter

  • Knight of the Sock
  • Hero Member
  • *****
  • Join Date: Aug 2003
  • Posts: 2961
    • Show only replies by adz
Re: Auto logon/logoff software
« Reply #9 on: March 25, 2004, 11:41:16 PM »
Kewl, I'll give it a go next week. How many machines do you image each night? I've come across a few places that re-image their machines each night, but its just too impractical to do in a school, seeing as we have 400 plus workstations, and around 10 or so different models. It was something we considered doing back in the days of NT and 98, but with the advent of "manageable" group policies and "usable" mandatory profiles in 2K server we very rarely have any problems, if any. Sorry for the little insight into my rather boring, but well paid, job, I get a bit carried away sometimes.