-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart.ps1
More file actions
55 lines (41 loc) · 1.47 KB
/
start.ps1
File metadata and controls
55 lines (41 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#
# Définition de l'adresse ip sur l'interface Ethernet
#
$ip = Get-NetIpAddress -InterfaceAlias "Ethernet" -AddressFamily IPv4
New-NetIPAddress -InterfaceIndex $ip.InterfaceIndex -IPAddress 192.168.0.1 -PrefixLength 24
#
# Fin de la définition de l'adresse ip
#
#
# Ajout des services de domaines
#
Add-WindowsFeature AD-Domain-Services -IncludeManagementTools
Install-WindowsFeature DHCP -IncludeManagementTools
Rename-Computer -NewName "SDC01"
#
# Fin de l'ajout des services de domaines
#
#
# Déploiment de la forêt
#
Import-Module ADDSDeployment
Install-ADDSForest -CreateDnsDelegation:$false -DatabasePath "C:\Windows\NTDS" -DomainMode "WinThreshold" -DomainName "marvelle.local" -DomainNetbiosName "MARVELLE" -ForestMode "WinThreshold" -InstallDns:$true -LogPath "C:\Windows\NTDS" -NoRebootOnCompletion:$true -SysvolPath "C:\Windows\SYSVOL" -Force:$true
#
# Fin du déploiement de la forêt
#
#
# Création de la tâche après redémarrage
#
$action = New-ScheduledTaskAction -Execute "powershell" -Argument "-File %USERPROFILE%\\Desktop\\init.ps1"
$trigger = New-ScheduledTaskTrigger -AtLogon
$principal = New-ScheduledTaskPrincipal -UserId "Administrateur"
$settings = New-ScheduledTaskSettingsSet
$task = New-ScheduledTask -Action $action -Principal $principal -Trigger $trigger -Settings $settings
Register-ScheduledTask -InputObject $task -TaskName "Init server"
#
# Fin de la création de la tâche
#
#
# Redémarrage de la machine
#
Restart-Computer