Code Script .co.uk

Home | Scripts | Tutorials | Disclaimer | Sitemap | Contact

   Autologon And Runonce
 

Vbscript / Operating System / Autologon And Runonce

The following code set the appropriate registry keys to login automatically and run a program once on the next login. This code runs on Server 2003, Windows XP and Vista.


Set objShell = WScript.CreateObject("WScript.Shell")

strUsername = "Admin"
strPassword = "Password123"


strRunOnce = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce\joinDomain"
objShell.RegWrite strRunOnce, "cmd.exe /c cscript c:\install\myscript.vbs", "REG_SZ"


strAutoLogon = "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\winlogon"
objShell.RegWrite strAutoLogon & "\AutoAdminLogon", "1", "REG_DWORD"
objShell.RegWrite strAutoLogon & "\DefaultUserName", strUsername, "REG_SZ"
objShell.RegWrite strAutoLogon & "\DefaultPassword", strPassword, "REG_SZ"





Please note that a disclaimer applies to any code on this page.
 
   Actions
  Go Back
  Bookmark
  Print Page


   Menu
 
- Links
- Reference
- Script Editors
- Tutorials
- Vbscript
     - Active Directory
     - Exchange
     - Files And Folders
     - General
     - Ms Office
     - Operating System
          - Add Remove Windows Server 2003 Components
          - Add Remove Windows Vista Components
          - Add Remove Windows Xp Components
          - Autologon And Runonce
          - Change Display Resolution
          - Change Location I386 Setup Files
          - Change Offline Folder Cache Location
          - Dell Bios Set Boot Device Order
          - Dell Bios Set Configuration Settings
          - Dell Bios View Configuration Settings
          - Dell Bios View Device Boot Order
          - Disable Vista User Account Control
          - Enumerate Cd Drives
          - Enumerate Computer Drives
          - Enumerate Disk Volumes
          - Enumerate Registry Keys
          - Flush Remote Dns Cache
          - Get Machine Hardware Model
          - Read Registry Key
          - Rename Computer
          - Rename Dell Machine By Service Tag
          - Set Internet Explorer Homepage
          - Set Random Desktop Wallpaper On Startup
          - Start And Stop A Service
          - Windows Login Timer
     - Processes And Services
     - Text Processing
     - User Interaction
     - Web Servers