Jump to content

Automated User Accounts


Recommended Posts

I have an idea but I don't know if it is possible. But I do know that there are a lot skillfull users at this board who could help me. ;)

Whilst Reading this article I came up with an idea:

Linkage

I thought: Isn't it possible to make a script (batch/vb) that shows the exact menu as showed in the article and then add a timer to it.

If you press a key during the countdown, (e.g enter) the script is iniated. If not it'll create a default account (or which you prefer) with a default username you have configured.

Is this a realistic Idea? I am not experienced with scripting but I think that this is possible. What about you?

Link to comment
Share on other sites


This is definately possible, and may not even be that hard either. I simply don't have the time at the moment to develop it. Perhaps in a couple of weeks. I will say though my mind has kind of taken off with the possibilities this has. For now I'll post a vbscript I run from RunOnceEx that does a lot of account housekeeping chores. If any scripting people out there want to take my code and run with it, have a ball..

Option Explicit
On Error Resume Next
Dim ws, fs, wn, objReg, sysdrv, strComputer, strPath, objComp, Drives, Drive, strCD, strOEM
Set ws = WScript.CreateObject("WScript.Shell")
Set fs = CreateObject("Scripting.FileSystemObject")
Set wn=WScript.CreateObject("WScript.Network")
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & "." & "\root\default:StdRegProv")
sysdrv = ws.ExpandEnvironmentStrings ("%SYSTEMDRIVE%")
strComputer=wn.ComputerName
strPath=("WinNT://" & strComputer)
Set objComp=GetObject(strPath)
Drives = Array("C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", _
"T", "U", "V", "W", "X", "Y", "Z")
For Each Drive In Drives
If fs.FileExists(Drive & ":\WIN51") Then strCD = Drive & ":\"
Next
strOEM = strCD & "OEM\"

'**********************************************************************
'** Subroutine; Process the built-in Administrator account           **
'**********************************************************************
Sub ProcessAdmin
Dim objUser1, objUser2, objGroup1, objGroup2, flag
Set objUser1=objComp.GetObject("user","Administrator")
Set objGroup1=objComp.GetObject("group","Debugger Users")
Set objGroup2=objComp.GetObject("group","Guests")
objGroup1.Remove objUser1.AdsPath
objGroup2.Add objUser1.AdsPath
objUser1.SetPassword "password1"
Set objUser2=objComp.MoveHere(objUser1.ADsPath,"Jerry")
objUser2.Description=""
objUser2.SetInfo
If objUser2.AccountDisabled="False" Then flag=objUser2.Get("UserFlags")+2
objUser2.Put "UserFlags", flag
objUser2.SetInfo
End Sub

'**********************************************************************
'** Subroutine; Process the built-in Guest account                   **
'**********************************************************************
Sub ProcessGuest
Dim objUser1, objUser2
Set objUser1=objComp.GetObject("user","Guest")
objUser1.SetPassword "password2"
Set objUser2=objComp.MoveHere(objUser1.AdsPath,"Kramer")
objUser2.Description=""
objUser2.SetInfo
End Sub

'**********************************************************************
'** Subroutine; Create and configure a new Administrator account     **
'**********************************************************************
Sub NewAdmin
Dim objUser, objGroup
Set objUser=objComp.Create("user", "Dave")
Set objGroup=objComp.GetObject("group","Administrators")
objUser.SetPassword "password"
objUser.FullName="David J. Doe"
objUser.SetInfo
objGroup.Add objUser.AdsPath
End Sub

'**********************************************************************
'** Subroutine; Create and configure a fake Administrator account    **
'**********************************************************************
Sub FakeAdmin
Dim objUser, objGroup, flag
Set objUser=objComp.Create("user", "Administrator")
Set objGroup=objComp.GetObject("group","Guests")
objUser.SetPassword "password4"
objUser.Description="Built-in account for administering the computer/domain"
objUser.FullName=""
objUser.SetInfo
objGroup.Add objUser.AdsPath
If objUser.AccountDisabled="False" Then flag=objUser.Get("UserFlags")+2
objUser.Put "UserFlags", flag
objUser.SetInfo
End Sub

'**********************************************************************
'** Run Tasks                                                        **
'**********************************************************************
ProcessAdmin
ProcessGuest
NewAdmin
FakeAdmin
ws.Run "REGEDIT /S " & strOEM & "\001_Registry.reg",0,True
fs.CopyFile (sysdrv & "\Documents and Settings\Administrator\ntuser.dat"), (sysdrv & "\Documents and Settings\Default User\ntuser.dat"),True
If fs.FolderExists(sysdrv & "\Documents and Settings\Administrator") Then fs.DeleteFolder(sysdrv & "\Documents and Settings\Administrator"), True
objComp.Delete "user", "Administrator"
objComp.Delete "user", "ASPNET"
objComp.Delete "user", "HelpAssistant"
objComp.Delete "user", "SUPPORT_388945a0"

EDIT: I don't know what the problem is exactly but for some reason whenever I post VBscript using code tags it screws up my comment lines putting in an ampersand, a space and then pound 39 or something. It's just a commented line is all.

Link to comment
Share on other sites

Before I starterd this thread, I was thinking about the User-Creation process of Longhorn 4008. This is almost an Automated Installation except for one thing:

When the installation is finished, it'll show a field where you must put in your name and then you must click create. The name will show directly beneath the form. I thought of a similar process for XP and add a timer. When in the given time no key is pressed it will create an account you configured.

When you think of it, it is actually rather useless but I have my reasons why it isn't:

For example: You are installing a pc for someone and you have your Unattended CD finished. You fired up the installation and everything is running smoothly.

A lot of people don't even care about what their name of their account is. Or even that it is pasword protected.

The script would assume that the PC is intended for one person. Then it would create the preconfigured account. But if there are more users then you can still add them. That's the whole idea behind this.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...