Windows Server scripting - first steps
************ Server machines << note the number 1 at the end of netsh command, which is for the metric of the 192.168.1.10 gateway >>
netsh interface ip set address name="Local Area Connection" static 192.168.1.1 255.255.255.0 192.168.1.10 1
netsh interface ip set dns name="Local Area Connection" static 192.168.1.1 primary
netdom renamecomputer %COMPUTERNAME% /NewName HAN-SRV-01 /ReBoot:5
netdom join %COMPUTERNAME% /domain:MYCOMPANY /ReBoot:5
************ Domain controllers for new domains
UNATTEND.TXT
[DCInstall]
DNSOnNetwork=No
DomainLevel=3
DomainNetBiosName=MYCOMPANY
ForestLevel=3
NewDomain=Forest
NewDomainDNSName=mycompany.com.vn
RebootOnCompletion=Yes
ReplicaOrNewDomain=Domain
SafeModeAdminPassword=P@ssw0rd
dcpromo /unattend:unattend.txt
************ Additional domain controllers
[DCInstall]
UserName=Administrator
Password=P@ssw0rd
UserDomain=mycompany.com.vn
DatabasePath=c:\windows\ntds
LogPath=c:\windows\ntds
SysVolPath=c:\windows\sysvol
SafeModeAdminPassword=P@ssw0rd
ReplicaOrNewDomain=Replica
ReplicaDomainDNSName=mycompany.com.vn
ReplicationSourceDC=han-srv-01.mycompany.com.vn
InstallDNS=yes
ConfirmGC=yes
RebootOnCompletion=yes
*********** additional RODC on a Server Core
; DCPROMO unattend file, automatically generated by dcpromo, by clicking the Export button at the end of the dcpromo wizard on a previous additional domain controller
; Usage: ; dcpromo.exe /unattend:C:\RODC-unattend.txt
; You may need to fill in password fields prior to using the unattend file. ; If you leave the values for "Password" and/or "DNSDelegationPassword" as "*", then you will be asked for credentials at runtime. Please use the domain admin, not the local admin of the Server Core
[DCInstall]
; Read-Only Replica DC promotion
ReplicaOrNewDomain=ReadOnlyReplica
ReplicaDomainDNSName=mycompany.com.vn
DelegatedAdmin="Administrator"
SiteName=Default-First-Site-Name
InstallDNS=Yes
ConfirmGc=Yes
CreateDNSDelegation=No
UserDomain=mycompany.com.vn
UserName=mycompany\administrator
Password=*
DatabasePath="C:\Windows\NTDS"
LogPath="C:\Windows\NTDS"
SYSVOLPath="C:\Windows\SYSVOL"
; Set SafeModeAdminPassword to the correct value prior to using the unattend file
SafeModeAdminPassword=P@ssw0rd
; Run-time flags (optional)
; CriticalReplicationOnly=Yes
; RebootOnCompletion=Yes
************ Client machines
netsh interface ip set address name="Local Area Connection" dhcp