Monday, July 24, 2006

Logon Script to Set Windows Default Log on To Domain

Simple little Visual Basic script today. It writes the registry key to specify which Domain Windows will choose for displaying in the GINA Log On To drop down box. It allows you to specify two different choices, a primary and an alternate, but you can always comment out the alternate if you wish.

' NAME: setLogonTo.vbs
'
' AUTHOR: Charles Wastell
' DATE : 7/24/2006
'
' Updates
'
' 7/24/06 - Initial Revision
'
' COMMENT: Changes the default Logon To at the Gina login box to the default domain.
' You can comment out lines 27 and 43 if you only have one domain to logon to.
'
'
'
' **********************************************************************************
' Variable Declarations
' **********************************************************************************

Dim defaultDomain, defaultAltDomain
Dim WshShell

' **********************************************************************************
' User Customizable Section
' **********************************************************************************

defaultDomain = "YOURDOMAIN"
defaultAltDomain = "YOURSECONDARYDOMAIN"


' **********************************************************************************
' Variable Initialization
' **********************************************************************************

Set WshShell = CreateObject("Wscript.Shell")

' **********************************************************************************
' Write Reg Keys
' **********************************************************************************

On Error Resume Next

WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName", defaultDomain ,"REG_SZ"
WshShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AltDefaultDomainName", defaultAltDomain , "REG_SZ"

WScript.Quit

No comments: