VB Scripting

  • Thread starter Thread starter Larry
  • Start date Start date
L

Larry

Is it possible to automate logging an XP PC onto a domain
through a VB script. I would like this script to run
once after deploying XP using ghost and sysprep.
Logging onto this particular acount installs additional
software(which cannot be installed before imaging) and
then logs off.

Thanks in advance.
 
Well, you can set the PC to automatically log on as Administrator through
the SYSPREP.INF file.

You can do this with the following entries:

[GuiUnattended]
AutoLogon=Yes
AutoLogonCount=1
AdminPassword="something"
EncryptedAdminPassword=NO

Just as an example...

But, you said you needed to be logged in as a domain account?
Add this entry to your SYSPREP.INF file as well:

[GuiRunOnce]
Command0=c:\myscript.vbs

(or wherever you want to put your script.)
This will automatically launch that program/file/script after the PC boots
into Windows.

In that script file, you can set the machine to log in as a domain user on
the next reboot. The code would be similar to the following:

======
dim shell : set shell = CreateObject("WScript.Shell")

shell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\AutoAdminLogon", "1", "REG_SZ"

shell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\DefaultDomainName", domainName, "REG_SZ"

shell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\DefaultUserName", userName, "REG_SZ"

shell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\DefaultPassword", passWord, "REG_SZ"

shell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\AutoLogonCount", "1", "REG_SZ"

===========

You should also add code to create a key in
HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce that will run the
install scripts for your programs.

The next step is to reboot the computer, which can be done through WMI, or
by running the SHUTDOWN.EXE command, or by any of your other favourite
methods. Once the computer reboots, it will log in with the information you
provided in the code above.

Hope this helps!

--
Mike Kolitz MCSE 2000
MS-MVP - Windows Setup and Deployment

Remember to check Windows Update often,
and apply the patches marked as Critical!
http://windowsupdate.microsoft.com

Protect your PC!
http://www.microsoft.com/security/protect
 
Thanks, i think thats what i need.
-----Original Message-----
Well, you can set the PC to automatically log on as Administrator through
the SYSPREP.INF file.

You can do this with the following entries:

[GuiUnattended]
AutoLogon=Yes
AutoLogonCount=1
AdminPassword="something"
EncryptedAdminPassword=NO

Just as an example...

But, you said you needed to be logged in as a domain account?
Add this entry to your SYSPREP.INF file as well:

[GuiRunOnce]
Command0=c:\myscript.vbs

(or wherever you want to put your script.)
This will automatically launch that program/file/script after the PC boots
into Windows.

In that script file, you can set the machine to log in as a domain user on
the next reboot. The code would be similar to the following:

======
dim shell : set shell = CreateObject ("WScript.Shell")

shell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\AutoAdminLogon", "1", "REG_SZ"

shell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\DefaultDomainName", domainName, "REG_SZ"

shell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\DefaultUserName", userName, "REG_SZ"

shell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\DefaultPassword", passWord, "REG_SZ"

shell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Winlogon\AutoLogonCount", "1", "REG_SZ"

===========

You should also add code to create a key in
HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce that will run the
install scripts for your programs.

The next step is to reboot the computer, which can be done through WMI, or
by running the SHUTDOWN.EXE command, or by any of your other favourite
methods. Once the computer reboots, it will log in with the information you
provided in the code above.

Hope this helps!

--
Mike Kolitz MCSE 2000
MS-MVP - Windows Setup and Deployment

Remember to check Windows Update often,
and apply the patches marked as Critical!
http://windowsupdate.microsoft.com

Protect your PC!
http://www.microsoft.com/security/protect


Is it possible to automate logging an XP PC onto a domain
through a VB script. I would like this script to run
once after deploying XP using ghost and sysprep.
Logging onto this particular acount installs additional
software(which cannot be installed before imaging) and
then logs off.

Thanks in advance.


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top