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!

Startup Script

Status
Not open for further replies.

markcampion

IS-IT--Management
Dec 29, 2004
6
GB
Hello,

I am currently trying to write a script that my engineers can execute after they have build new clients.

The client are Windows XP
As part of the script i need to change the following:

Change comp name (which i have sorted)
Join the domain (within script, no engineer input)
change the local administrators passowrd (within script, no engineer input)
Change symantec antivirus parent site server by changing registry keys:

HKEY_LOCAL_MACHINE\SOFTWARE\INTEL\LANDesk\VirusProtect6\CurrentVersion

-Alert Directory (prompt engineer for input)
-Parent (prompt engineer for input)
-RemoteHomeDirectory (prompt engineer for input)

Please help!!!
Also could you recommend the best 2000 / xp scripting reference book you know!

Thanks
 
you should find plenty of example on this forum for

RegWrite
InputBox
and Admin Password

use the search facility and post what you come up with and we can take a look and give you a few pointers
 
I've sorted the renaming of the computer bit however i am unsure about the joining of the domain. there doesn't seem to be much about joining the local machine you are running the script from. this is what i have so far:

'*************************************************************************
'
'*************************************************************************
Set WshShell = WScript.CreateObject("WScript.Shell")

'Create the variables
Dim ChangeNameMsg, ChangeNameTitle
Dim name, ipaddress, gateway
Dim ActiveComputerName, ComputerName, Hostname
Dim NewActiveComputerName, NewComputerName, NewHostname

'Set up message boxes and give variables values
ChangeNameMsg = "Please enter Computername"
ChangeNameTitle = "Rename local Client"
name = InputBox(ChangeNameMsg,ChangeNameTitle)

' Give variables values
ActiveComputerName = "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ActiveComputerName\ComputerName"
ComputerName = "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName\ComputerName"
Hostname = "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\NVHostname"

NewActiveComputerName = name
NewComputerName = name
NewHostname = name

'use regwrite to change value in registry, in accordance with variables,
WshShell.RegWrite ActiveComputerName, NewActiveComputerName
WshShell.RegWrite ComputerName, NewComputerName
WshShell.RegWrite Hostname, NewHostname
'Echo changes
Wscript.Echo "Your ComputerName is now", name
Call WSHShell.Run("cmd.exe /c NETDOM JOIN " & strWorkstation & " Domain:Mearsdom Userd:Netdom Passwordd:*")
Set up a reboot in 5 seconds
Set OpSysSet = GetObject("winmgmts:{(Shutdown)}//./root/cimv2").ExecQuery("select * from Win32_OperatingSystem where Primary=true")
for each OpSys in OpSysSet
OpSys.reboot(5)
Next
 
will you need a reboot between renaming the machine and then joining that new machine name to the domain??

also you use 'strWorkstation' in the this line but i cant see it declared or populated anywhere else?

Call WSHShell.Run("cmd.exe /c NETDOM JOIN " & strWorkstation & " Domain:Mearsdom Userd:Netdom Passwordd:*")
 
Yes you are right. Sorry about that, typo. Shame about the reboot thing as it would have been good to do it all in a 1'er.

think what i will do is separate the two procs and call the netdom join after reboot (get the 1st one to stick it in the startup or something) what do you think?

Cheers for the help mate
Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top