Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

auto logon to create user folders

Status
Not open for further replies.

itsteapot

Technical User
Mar 27, 2009
49
GB
Hi All, I have a script to create users in active directory, however is it possible to have a script run to auto logon each user in turn to create their home folders?
Thanks for any ideas.
 
It's faily intensive but you can configure the registry to auto logon.

This script needs to be run locally.
Code:
strDomain = ""
strUsername = ""
strPassword = ""

set objShell = CreateObject("Wscript.Shell")
objShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultUserName", strUsername, "REG_SZ"
objShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultDomainName", strDomain, "REG_SZ"
objShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\DefaultPassword", strPassword, "REG_SZ"
objShell.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon\AutoAdminLogon", "1", "REG_SZ"

This script can be run remotely
Code:
CONST HKLM = &H80000002

strComputer = "."
strDomain = ""
strUsername = ""
strPassword = ""

set objReg = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

objReg.SetStringValue HKLM, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultUserName", strUsername
objReg.SetStringValue HKLM, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultDomainName", strDomain
objReg.SetStringValue HKLM, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "DefaultPassword", strPassword
objReg.SetStringValue HKLM, "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon", "AutoAdminLogon", "1"

-Geates
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top