update
This commit is contained in:
parent
9f02aa3a91
commit
d82954d30c
@ -13,7 +13,6 @@ Import-Module ActiveDirectory
|
||||
$Fichier = "OU-Standard.csv"
|
||||
|
||||
$OUs = Import-Csv -Path $Fichier -Delimiter ";"
|
||||
|
||||
$dNC = (Get-ADRootDSE).defaultNamingContext
|
||||
|
||||
$OUs | ForEach-Object {
|
||||
|
@ -1,4 +1,4 @@
|
||||
throw "This is not a robus script"
|
||||
#throw "This is not a robus script"
|
||||
$location = Get-Location
|
||||
Set-Location C:\Tools
|
||||
|
||||
@ -7,125 +7,29 @@ $dNC = (Get-ADRootDSE).defaultNamingContext
|
||||
|
||||
|
||||
#region Create Top Level OU's
|
||||
$OUs = @(
|
||||
$(New-Object PSObject -Property @{Name = "Admin"; ParentOU = "" }),
|
||||
$(New-Object PSObject -Property @{Name = "Groups"; ParentOU = "" }),
|
||||
$(New-Object PSObject -Property @{Name = "Tier 1 Servers"; ParentOU = "" }),
|
||||
$(New-Object PSObject -Property @{Name = "Workstations"; ParentOU = "" }),
|
||||
$(New-Object PSObject -Property @{Name = "User accounts"; ParentOU = "" }),
|
||||
$(New-Object PSObject -Property @{Name = "Quarantine"; ParentOU = "" })
|
||||
)
|
||||
.\Create-OU.ps1 -OUs $OUs -Verbose
|
||||
./Step-01-Creation-OU.ps1
|
||||
#endRegion
|
||||
|
||||
#region Create Sub Admin OU's
|
||||
$OUs = @(
|
||||
$(New-Object PSObject -Property @{Name = "Tier0"; ParentOU = "ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Tier1"; ParentOU = "ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Tier2"; ParentOU = "ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Accounts"; ParentOU = "ou=Tier0,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Groups"; ParentOU = "ou=Tier0,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Service Accounts"; ParentOU = "ou=Tier0,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Devices"; ParentOU = "ou=Tier0,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Tier0 Servers"; ParentOU = "ou=Tier0,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Accounts"; ParentOU = "ou=Tier1,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Groups"; ParentOU = "ou=Tier1,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Service Accounts"; ParentOU = "ou=Tier1,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Devices"; ParentOU = "ou=Tier1,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Accounts"; ParentOU = "ou=Tier2,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Groups"; ParentOU = "ou=Tier2,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Service Accounts"; ParentOU = "ou=Tier2,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Name = "Devices"; ParentOU = "ou=Tier2,ou=Admin" })
|
||||
)
|
||||
.\Create-OU.ps1 -OUs $OUs -Verbose
|
||||
./Step-02-Creation-Groupe.ps1
|
||||
#endRegion
|
||||
|
||||
#region Create Sub Groups OU's
|
||||
$OUs = @(
|
||||
$(New-Object PSObject -Property @{Name = "Security Groups"; ParentOU = "ou=Groups" }),
|
||||
$(New-Object PSObject -Property @{Name = "Distribution Groups"; ParentOU = "ou=Groups" }),
|
||||
$(New-Object PSObject -Property @{Name = "Contacts"; ParentOU = "ou=Groups" })
|
||||
)
|
||||
.\Create-OU.ps1 -OUs $OUs -Verbose
|
||||
$OUs = @(
|
||||
$(New-Object PSObject -Property @{Name = "Application"; ParentOU = "ou=Tier 1 Servers" }),
|
||||
$(New-Object PSObject -Property @{Name = "Collaboration"; ParentOU = "ou=Tier 1 Servers" }),
|
||||
$(New-Object PSObject -Property @{Name = "Database"; ParentOU = "ou=Tier 1 Servers" }),
|
||||
$(New-Object PSObject -Property @{Name = "Messaging"; ParentOU = "ou=Tier 1 Servers" }),
|
||||
$(New-Object PSObject -Property @{Name = "Staging"; ParentOU = "ou=Tier 1 Servers" })
|
||||
)
|
||||
.\Create-OU.ps1 -OUs $OUs -Verbose
|
||||
$OUs = @(
|
||||
$(New-Object PSObject -Property @{Name = "Desktops"; ParentOU = "ou=Workstations" }),
|
||||
$(New-Object PSObject -Property @{Name = "Kiosks"; ParentOU = "ou=Workstations" }),
|
||||
$(New-Object PSObject -Property @{Name = "Laptops"; ParentOU = "ou=Workstations" }),
|
||||
$(New-Object PSObject -Property @{Name = "Staging"; ParentOU = "ou=Workstations" })
|
||||
)
|
||||
.\Create-OU.ps1 -OUs $OUs -Verbose
|
||||
./Step-03-Set-OUUserPermissions.ps1
|
||||
#endRegion
|
||||
|
||||
#region Create Sub User Accounts OU's
|
||||
$OUs = @(
|
||||
$(New-Object PSObject -Property @{Name = "Enabled Users"; ParentOU = "ou=User Accounts" }),
|
||||
$(New-Object PSObject -Property @{Name = "Disabled Users"; ParentOU = "ou=User Accounts" })
|
||||
)
|
||||
.\Create-OU.ps1 -OUs $OUs -Verbose
|
||||
./Step-04-Set-OUWorkstationPermissions.ps1
|
||||
#endRegion
|
||||
|
||||
#Region Block inheritance for PAW OUs
|
||||
Set-GpInheritance -Target "OU=Devices,OU=Tier0,OU=Admin,$dnc" -IsBlocked Yes | Out-Null
|
||||
Set-GpInheritance -Target "OU=Devices,OU=Tier1,OU=Admin,$dnc" -IsBlocked Yes | Out-Null
|
||||
Set-GpInheritance -Target "OU=Devices,OU=Tier2,OU=Admin,$dnc" -IsBlocked Yes | Out-Null
|
||||
./Step-05-Set-OUGroupPermissions.ps1
|
||||
#endRegion
|
||||
|
||||
#Region create Groups
|
||||
$csv = Read-Host -Prompt "Please provide full path to Admin Groups csv file"
|
||||
.\Create-Group.ps1 -CSVfile $csv -Verbose
|
||||
$csv = Read-Host -Prompt "Please provide full path to Standard Groups csv file"
|
||||
.\Create-Group.ps1 -CSVfile $csv -Verbose
|
||||
#endRegion
|
||||
|
||||
|
||||
#Region Create OU Delegation
|
||||
$List = @(
|
||||
$(New-Object PSObject -Property @{Group = "Tier2ServiceDeskOperators"; OUPrefix = "OU=User Accounts" }),
|
||||
$(New-Object PSObject -Property @{Group = "Tier1Admins"; OUPrefix = "OU=Accounts,ou=Tier1,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Group = "Tier1Admins"; OUPrefix = "OU=Service Accounts,ou=Tier1,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Group = "Tier2Admins"; OUPrefix = "OU=Accounts,ou=Tier2,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Group = "Tier2Admins"; OUPrefix = "OU=Service Accounts,ou=Tier2,ou=Admin" })
|
||||
)
|
||||
.\Set-OUUserPermissions.ps1 -list $list -Verbose
|
||||
|
||||
$List = @(
|
||||
$(New-Object PSObject -Property @{Group = "Tier2ServiceDeskOperators"; OUPrefix = "OU=Workstations" }),
|
||||
$(New-Object PSObject -Property @{Group = "Tier1Admins"; OUPrefix = "OU=Devices,ou=Tier1,ou=Admin" }),
|
||||
$(New-Object PSObject -Property @{Group = "Tier2Admins"; OUPrefix = "OU=Devices,ou=Tier2,ou=Admin" })
|
||||
)
|
||||
.\Set-OUWorkstationPermissions.ps1 -list $list -Verbose
|
||||
|
||||
$List = @(
|
||||
$(New-Object PSObject -Property @{Group = "Tier1Admins"; OUPrefix = "OU=Groups,ou=Tier1,ou=Admin"}),
|
||||
$(New-Object PSObject -Property @{Group = "Tier2Admins"; OUPrefix = "OU=Groups,ou=Tier2,ou=Admin"})
|
||||
)
|
||||
.\Set-OUGroupPermissions.ps1 -list $list -Verbose
|
||||
|
||||
$List = @(
|
||||
$(New-Object PSObject -Property @{Group = "Tier2Tier2WorkstationMaintenance"; OUPrefix = "OU=Quarantine" }),
|
||||
$(New-Object PSObject -Property @{Group = "Tier2WorkstationMaintenance"; OUPrefix = "OU=Workstations" }),
|
||||
$(New-Object PSObject -Property @{Group = "Tier1ServerMaintenance"; OUPrefix = "OU=Tier 1 Servers" })
|
||||
)
|
||||
.\Set-OUComputerPermissions.ps1 -list $list -Verbose
|
||||
|
||||
$List = @(
|
||||
$(New-Object PSObject -Property @{Group = "Tier0ReplicationMaintenance"; OUPrefix = "" })
|
||||
)
|
||||
.\Set-OUReplicationPermissions.ps1 -list $list -Verbose
|
||||
|
||||
$List = @(
|
||||
$(New-Object PSObject -Property @{Group = "Tier1ServerMaintenance"; OUPrefix = "OU=Tier 1 Servers" })
|
||||
)
|
||||
.\Set-OUGPOPermissions.ps1 -list $list -Verbose
|
||||
|
||||
./Step-06-Set-OUComputerPermissions.ps1
|
||||
./Step-07-Set-OUReplicationPermissions.ps1
|
||||
./Step-08-Set-OUGPOPermissions.ps1
|
||||
#endRegion
|
||||
|
||||
Set-Location $location
|
||||
|
482
step-00-Creation-Fichier.ps1
Normal file
482
step-00-Creation-Fichier.ps1
Normal file
@ -0,0 +1,482 @@
|
||||
Function Write-Color([String[]]$Text, [ConsoleColor[]]$Color = "White", [int]$StartTab = 0, [int] $LinesBefore = 0,[int] $LinesAfter = 0, [string] $LogFile = "", $TimeFormat = "yyyy-MM-dd HH:mm:ss") {
|
||||
$DefaultColor = $Color[0]
|
||||
If ($LinesBefore -ne 0) { for ($i = 0; $i -lt $LinesBefore; $i++) { Write-Host "`n" -NoNewline } } # Add empty line before
|
||||
If ($StartTab -ne 0) { for ($i = 0; $i -lt $StartTab; $i++) { Write-Host "`t" -NoNewLine } } # Add TABS before text
|
||||
If ($Color.Count -ge $Text.Count) {
|
||||
for ($i = 0; $i -lt $Text.Length; $i++) { Write-Host $Text[$i] -ForegroundColor $Color[$i] -NoNewLine }
|
||||
}
|
||||
Else {
|
||||
for ($i = 0; $i -lt $Color.Length ; $i++) { Write-Host $Text[$i] -ForegroundColor $Color[$i] -NoNewLine }
|
||||
for ($i = $Color.Length; $i -lt $Text.Length; $i++) { Write-Host $Text[$i] -ForegroundColor $DefaultColor -NoNewLine }
|
||||
}
|
||||
Write-Host
|
||||
If ($LinesAfter -ne 0) { for ($i = 0; $i -lt $LinesAfter; $i++) { Write-Host "`n" } } # Add empty line after
|
||||
If ($LogFile -ne "") {
|
||||
$TextToFile = ""
|
||||
For ($i = 0; $i -lt $Text.Length; $i++) {
|
||||
$TextToFile += $Text[$i]
|
||||
}
|
||||
Write-Output "[$([datetime]::Now.ToString($TimeFormat))]$TextToFile" | Out-File $LogFile -Encoding unicode -Append
|
||||
}
|
||||
}
|
||||
|
||||
Function OnLoadForm() {
|
||||
If($FichierOUStandard) {
|
||||
Write-Color -Text "[ ", "Le fichier : ", $FichierOUStandard, " existe ]" -Color Yellow,Green,White,Yellow
|
||||
}
|
||||
}
|
||||
|
||||
cls
|
||||
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
# Dépclation de variable global
|
||||
#
|
||||
|
||||
$SourceXML = $null
|
||||
#$Fichier = "C:\Automation\liste.xml"
|
||||
$Data = $null
|
||||
|
||||
$FichierOUStandard = "OU-Standard.csv"
|
||||
$FichierGroupesAdministrateur = "Groupes-Administrateur.csv"
|
||||
$FichierGroupesStandard = "Groupes-Standard.csv"
|
||||
$FichierOUUserPermissions = "OU-User-Permissions.csv"
|
||||
$FichierOUWorkstationPermissions = "OU-Workstation-Permissions.csv"
|
||||
$FichierOUGroupPermissions = "OU-Group-Permissions.csv"
|
||||
$FichierOUComputerPermissions = "OU-Computer-Permissions.csv"
|
||||
$FichierOUReplicationPermissions = "OU-Replication-Permissions.csv"
|
||||
$FichierOUGPOPermissions = "OU-GPO-Permissions.csv"
|
||||
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
# Mise en forme de l'affichage global
|
||||
#
|
||||
|
||||
#Assemblies
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
[System.Windows.Forms.Application]::EnableVisualStyles()
|
||||
|
||||
#Frame
|
||||
$frm = New-Object system.Windows.Forms.Form
|
||||
$frm.ClientSize = New-Object System.Drawing.Point(420,440)
|
||||
$frm.text = "Creation des fichiers de configuration"
|
||||
$frm.TopMost = $false
|
||||
$frm.BackColor = [System.Drawing.ColorTranslator]::FromHtml("#ffffff")
|
||||
$frm.TopMost = $false
|
||||
$frm.FormBorderStyle = "Fixed3D" #"FixedSingle"
|
||||
$frm.startposition = "CenterScreen"
|
||||
$frm.MaximizeBox = $false
|
||||
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
#
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
|
||||
#
|
||||
$GroupBoxOrganisation = New-Object System.Windows.Forms.GroupBox -Property @{
|
||||
Text = "Nom de votre organisation"
|
||||
Width = 405
|
||||
Height = 90
|
||||
Location = New-Object System.Drawing.Point(8,8)
|
||||
}
|
||||
|
||||
#
|
||||
$GroupBoxFile = New-Object System.Windows.Forms.GroupBox -Property @{
|
||||
Text = "Fichier généré"
|
||||
Width = 405
|
||||
Height = 220
|
||||
Location = New-Object System.Drawing.Point(8,106)
|
||||
}
|
||||
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
#
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
|
||||
#
|
||||
$LabelName = New-Object System.Windows.Forms.Label -Property @{
|
||||
Text = "Nom de l'organisation"
|
||||
Width = 180
|
||||
Height = 25
|
||||
location = New-Object System.Drawing.Point(20,25)
|
||||
Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
|
||||
AutoSize = $false
|
||||
}
|
||||
|
||||
#
|
||||
$LabelOUStandard = New-Object System.Windows.Forms.Label -Property @{
|
||||
Text = " * OU-Standard.csv"
|
||||
Width = 250
|
||||
Height = 20
|
||||
location = New-Object System.Drawing.Point(20,20)
|
||||
Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
|
||||
AutoSize = $false
|
||||
Visible = $false
|
||||
}
|
||||
|
||||
#
|
||||
$LabelGroupesAdministrateur = New-Object System.Windows.Forms.Label -Property @{
|
||||
Text = " * Groupes-Administrateur.csv"
|
||||
Width = 250
|
||||
Height = 20
|
||||
location = New-Object System.Drawing.Point(20,40)
|
||||
Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
|
||||
AutoSize = $false
|
||||
Visible = $false
|
||||
}
|
||||
|
||||
#
|
||||
$LabelGroupesStandard = New-Object System.Windows.Forms.Label -Property @{
|
||||
Text = " * Groupes-Standard.csv"
|
||||
Width = 250
|
||||
Height = 20
|
||||
location = New-Object System.Drawing.Point(20,60)
|
||||
Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
|
||||
AutoSize = $false
|
||||
Visible = $false
|
||||
}
|
||||
|
||||
#
|
||||
$LabelOUUserPermissions = New-Object System.Windows.Forms.Label -Property @{
|
||||
Text = " * OU-User-Permissions.csv"
|
||||
Width = 250
|
||||
Height = 20
|
||||
location = New-Object System.Drawing.Point(20,80)
|
||||
Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
|
||||
AutoSize = $false
|
||||
Visible = $false
|
||||
}
|
||||
|
||||
#
|
||||
$LabelOUWorkstationPermissions = New-Object System.Windows.Forms.Label -Property @{
|
||||
Text = " * OU-Workstation-Permissions.csv"
|
||||
Width = 250
|
||||
Height = 20
|
||||
location = New-Object System.Drawing.Point(20,100)
|
||||
Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
|
||||
AutoSize = $false
|
||||
Visible = $false
|
||||
}
|
||||
|
||||
#
|
||||
$LabelOUGroupPermissions = New-Object System.Windows.Forms.Label -Property @{
|
||||
Text = " * OU-Group-Permissions.csv"
|
||||
Width = 250
|
||||
Height = 20
|
||||
location = New-Object System.Drawing.Point(20,120)
|
||||
Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
|
||||
AutoSize = $false
|
||||
Visible = $false
|
||||
}
|
||||
|
||||
#
|
||||
$LabelOUComputerPermissions = New-Object System.Windows.Forms.Label -Property @{
|
||||
Text = " * OU-Computer-Permissions.csv"
|
||||
Width = 250
|
||||
Height = 20
|
||||
location = New-Object System.Drawing.Point(20,140)
|
||||
Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
|
||||
AutoSize = $false
|
||||
Visible = $false
|
||||
}
|
||||
|
||||
#
|
||||
$LabelOUReplicationPermissions = New-Object System.Windows.Forms.Label -Property @{
|
||||
Text = " * OU-Replication-Permissions.csv"
|
||||
Width = 250
|
||||
Height = 20
|
||||
location = New-Object System.Drawing.Point(20,160)
|
||||
Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
|
||||
AutoSize = $false
|
||||
Visible = $false
|
||||
}
|
||||
|
||||
#
|
||||
$LabelOUGPOPermissions = New-Object System.Windows.Forms.Label -Property @{
|
||||
Text = " * OU-GPO-Permissions.csv"
|
||||
Width = 250
|
||||
Height = 20
|
||||
location = New-Object System.Drawing.Point(20,180)
|
||||
Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
|
||||
AutoSize = $false
|
||||
Visible = $false
|
||||
}
|
||||
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
#
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
|
||||
#
|
||||
$TextOrganisation = New-Object System.Windows.Forms.TextBox -Property @{
|
||||
Text = "Societe"
|
||||
Width = 190
|
||||
Height = 25
|
||||
location = New-Object System.Drawing.Point(200,25)
|
||||
Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
|
||||
AutoSize = $false
|
||||
}
|
||||
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
# Ajout des zone de Button pour les changements d'état
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
|
||||
#
|
||||
$btnClose = New-Object Windows.Forms.Button -Property @{
|
||||
Location = New-Object Drawing.Point 290, 405
|
||||
Size = New-Object Drawing.Size 120, 30
|
||||
Text = 'Fermer'
|
||||
Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
|
||||
}
|
||||
|
||||
#
|
||||
$btnGeneration = New-Object Windows.Forms.Button -Property @{
|
||||
Location = New-Object Drawing.Point 145, 55
|
||||
Size = New-Object Drawing.Size 120, 30
|
||||
Text = 'Generation'
|
||||
Font = New-Object System.Drawing.Font('Microsoft Sans Serif',10)
|
||||
}
|
||||
|
||||
$frm.controls.AddRange(@($GroupBoxOrganisation,$GroupBoxFile))
|
||||
|
||||
$GroupBoxOrganisation.Controls.AddRange(@($TextOrganisation))
|
||||
$GroupBoxOrganisation.Controls.AddRange(@($LabelName))
|
||||
$GroupBoxOrganisation.Controls.AddRange(@($btnGeneration))
|
||||
|
||||
$GroupBoxFile.Controls.AddRange(@($LabelOUStandard,$LabelGroupesAdministrateur,$LabelGroupesStandard,$LabelOUUserPermissions,$LabelOUWorkstationPermissions,$LabelOUGroupPermissions,$LabelOUComputerPermissions,$LabelOUReplicationPermissions,$LabelOUGPOPermissions))
|
||||
|
||||
$frm.controls.AddRange(@($btnClose))
|
||||
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
# Action pour les Boutons
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
# Action pour les Boutons global
|
||||
#
|
||||
#*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-
|
||||
#
|
||||
|
||||
#
|
||||
$btnClose.Add_Click({
|
||||
$frm.Add_FormClosing({$_.Cancel=$False})
|
||||
$frm.Close()
|
||||
})
|
||||
|
||||
$btnGeneration.Add_Click({
|
||||
$OUMaster = $TextOrganisation.Text
|
||||
Write-Color -Text "[ ", "Generation des fichiers pour l'organisation : ", $OUMaster, " ]" -Color Yellow,Green,White,Yellow
|
||||
|
||||
$textOUStandard = @"
|
||||
Name;ParentOU;Description;IsBlocked
|
||||
$OUMaster;;Base de la $OUMaster;No
|
||||
Admins;$OUMaster;;No
|
||||
Tier 1 Servers;$OUMaster;;No
|
||||
Groupes;$OUMaster;;No
|
||||
WorkStations;$OUMaster;;No
|
||||
Serveurs;$OUMaster;;No
|
||||
Users;$OUMaster;;No
|
||||
Quarantine;$OUMaster;;No
|
||||
Tier0;Admins,ou=$OUMaster;;No
|
||||
Tier1;Admins,ou=$OUMaster;;No
|
||||
Tier2;Admins,ou=$OUMaster;;No
|
||||
Accounts;Tier0,ou=Admins,ou=$OUMaster;;No
|
||||
Groupes;Tier0,ou=Admins,ou=$OUMaster;;No
|
||||
Service Accounts;Tier0,ou=Admins,ou=$OUMaster;;No
|
||||
Devices;Tier0,ou=Admins,ou=$OUMaster;;Yes
|
||||
Tier0 Serveurs;Tier0,ou=Admins,ou=$OUMaster;;No
|
||||
Accounts;Tier1,ou=Admins,ou=$OUMaster;;No
|
||||
Groupes;Tier1,ou=Admins,ou=$OUMaster;;No
|
||||
Service Accounts;Tier1,ou=Admins,ou=$OUMaster;;No
|
||||
Devices;Tier1,ou=Admins,ou=$OUMaster;;Yes
|
||||
Tier1 Serveurs;Tier1,ou=Admins,ou=$OUMaster;;No
|
||||
Accounts;Tier2,ou=Admins,ou=$OUMaster;;No
|
||||
Groupes;Tier2,ou=Admins,ou=$OUMaster;;No
|
||||
Service Accounts;Tier2,ou=Admins,ou=$OUMaster;;No
|
||||
Devices;Tier2,ou=Admins,ou=$OUMaster;;Yes
|
||||
Contacts;Groupes,ou=$OUMaster;;No
|
||||
Softwares;Groupes,ou=$OUMaster;;No
|
||||
Partages;Groupes,ou=$OUMaster;;No
|
||||
Providers;Groupes,ou=$OUMaster;;No
|
||||
Ressources;Groupes,ou=$OUMaster;;No
|
||||
Groupes Distribution;Contacts,ou=Groupes,ou=$OUMaster;;No
|
||||
Groupes Security;Contacts,ou=Groupes,ou=$OUMaster;;No
|
||||
Groupes Distribution;Softwares,ou=Groupes,ou=$OUMaster;;No
|
||||
Groupes Security;Softwares,ou=Groupes,ou=$OUMaster;;No
|
||||
Groupes Distribution;Partages,ou=Groupes,ou=$OUMaster;;No
|
||||
Groupes Security;Partages,ou=Groupes,ou=$OUMaster;;No
|
||||
Groupes Distribution;Ressources,ou=Groupes,ou=$OUMaster;;No
|
||||
Groupes Security;Ressources,ou=Groupes,ou=$OUMaster;;No
|
||||
Desktops;WorkStations,ou=$OUMaster;;No
|
||||
Kiosks;WorkStations,ou=$OUMaster;;No
|
||||
Laptops;WorkStations,ou=$OUMaster;;No
|
||||
Staging;WorkStations,ou=$OUMaster;;No
|
||||
Dev;Serveurs,ou=$OUMaster;;No
|
||||
Application;Dev,ou=Serveurs,ou=$OUMaster;;No
|
||||
Collaboration;Dev,ou=Serveurs,ou=$OUMaster;;No
|
||||
Database;Dev,ou=Serveurs,ou=$OUMaster;;No
|
||||
Messaging;Dev,ou=Serveurs,ou=$OUMaster;;No
|
||||
Staging;Dev,ou=Serveurs,ou=$OUMaster;;No
|
||||
Rec;Serveurs,ou=$OUMaster;;No
|
||||
Application;Rec,ou=Serveurs,ou=$OUMaster;;No
|
||||
Collaboration;Rec,ou=Serveurs,ou=$OUMaster;;No
|
||||
Database;Rec,ou=Serveurs,ou=$OUMaster;;No
|
||||
Messaging;Rec,ou=Serveurs,ou=$OUMaster;;No
|
||||
Staging;Rec,ou=Serveurs,ou=$OUMaster;;No
|
||||
Staging;Serveurs,ou=$OUMaster;;No
|
||||
Application;Staging,ou=Serveurs,ou=$OUMaster;;No
|
||||
Collaboration;Staging,ou=Serveurs,ou=$OUMaster;;No
|
||||
Database;Staging,ou=Serveurs,ou=$OUMaster;;No
|
||||
Messaging;Staging,ou=Serveurs,ou=$OUMaster;;No
|
||||
Staging;Staging,ou=Serveurs,ou=$OUMaster;;No
|
||||
Production;Serveurs,ou=$OUMaster;;No
|
||||
Application;Production,ou=Serveurs,ou=$OUMaster;;No
|
||||
Collaboration;Production,ou=Serveurs,ou=$OUMaster;;No
|
||||
Database;Production,ou=Serveurs,ou=$OUMaster;;No
|
||||
Messaging;Production,ou=Serveurs,ou=$OUMaster;;No
|
||||
Staging;Production,ou=Serveurs,ou=$OUMaster;;No
|
||||
_Disabled Users;Users,ou=$OUMaster;;No
|
||||
_To Deleted;Users,ou=$OUMaster;;No
|
||||
_In Arrived;Users,ou=$OUMaster;;No
|
||||
Providers;Users,ou=$OUMaster;;No
|
||||
Service_A;Users,ou=$OUMaster;;No
|
||||
Service_B;Users,ou=$OUMaster;;No
|
||||
Service_C;Users,ou=$OUMaster;;No
|
||||
"@
|
||||
|
||||
$LabelOUStandard.Visible = $true
|
||||
Set-Content -Path $FichierOUStandard -Value $textOUStandard
|
||||
Write-Color -Text "[ ", "Generation du fichier : ", "OU-Standard.csv", " ]" -Color Yellow,Green,White,Yellow
|
||||
|
||||
$textGroupesAdministrateur = @"
|
||||
Name;samAccountName;GroupCategory;GroupScope;DisplayName;OU;Description;Membership
|
||||
Tier 0 PAW Users;Tier0PAWUsers;Security;Global;Tier 0 PAW Users;OU=Groupes,OU=Tier0,OU=Admins,OU=$OUMaster;Les membres OU=Groupes,OU=de ce groupe sont autorisés à se connecter aux postes de travail à accès privilégié de Tier0 à l'aide de comptes normaux.;
|
||||
Tier 0 PAW Maintenance;Tier0PAWMaint;Security;Global;Tier 0 PAW Maintenance;OU=Groupes,OU=Tier0,OU=Admins,OU=$OUMaster;Les membres de ce groupe assurent la maintenance et le support des postes de travail à accès privilégié de Tier0.;
|
||||
Tier 0 Replication Maintenance;Tier0ReplicationMaintenance;Security;Global;Tier 0 Replication Maintenance;OU=Groupes,OU=Tier0,OU=Admins,OU=$OUMaster;Les membres de ce groupe sont les responsables de la maintenance de la réplication de Tier0.;
|
||||
Tier 0 Servers;Tier0Servers;Security;Global;Tier 0 Servers;OU=Groupes,OU=Tier0,OU=Admins,OU=$OUMaster;Groupe contenant tous les serveurs de Tier0;
|
||||
Tier 0 Sync Servers;Tier0SyncServers;Security;Global;Tier 0 Sync Servers;OU=Groupes,OU=Tier0,OU=Admins,OU=$OUMaster;Groupe contenant tous les serveurs de synchronisation de Tier0;
|
||||
Tier 0 Physical Access;Tier0PhysicalAccess;Security;Global;Tier 0 PhysicalAccess;OU=Groupes,OU=Tier0,OU=Admins,OU=$OUMaster;Groupe contenant les utilisateurs autorisés à accéder au contrôleur de domaine physique;
|
||||
Tier 0 Physical DC;Tier0PhysicalDC;Security;Global;Tier 0 PhysicalDC;OU=Groupes,OU=Tier0,OU=Admins,OU=$OUMaster;Groupe qui contient l'objet informatique contrôleur de domaine physique;
|
||||
Tier 0 Service Accounts;Tier0serviceaccounts;Security;Global;Tier 0 Service Accounts;OU=Groupes,OU=Tier0,OU=Admins,OU=$OUMaster;Groupe contenant tous les comptes de service de Tier0;
|
||||
Tier 0 PAW Computers;Tier0PAWComputers;Security;Global;Tier 0 PAW Computers;OU=Groupes,OU=Tier0,OU=Admins,OU=$OUMaster;Groupe avec les membres des dispositifs de Tier0 serveurs et contrôleurs de domaine;
|
||||
Tier 1 Admins;tier1admins;Security;Global;Tier 1 Admins;OU=Groupes,OU=Tier1,OU=Admins,OU=$OUMaster;Les membres de ce groupe sont des administrateurs de Tier1.;
|
||||
Tier 1 Server Maintenance;Tier1ServerMaintenance;Security;Global;Tier 1 Server Maintenance;OU=Groupes,OU=Tier1,OU=Admins,OU=$OUMaster;Les membres de ce groupe assurent la maintenance des serveurs de Tier1.;
|
||||
Tier 1 PAW Users;Tier1PAWUsers;Security;Global;Tier 1 PAW Users;OU=Groupes,OU=Tier1,OU=Admins,OU=$OUMaster;Les membres de ce groupe sont autorisés à se connecter aux postes de travail à accès privilégié de Tier1 à l'aide de comptes normaux.;
|
||||
Tier 1 PAW Computers;Tier1PAWComputers;Security;Global;Tier 1 PAW Computers;OU=Groupes,OU=Tier1,OU=Admins,OU=$OUMaster;Groupe avec les membres des appareils et serveurs de Tier1;
|
||||
Tier 1 PAW Maintenance;Tier1PAWMaint;Security;Global;Tier1 PAW Maintenance;OU=Groupes,OU=Tier1,OU=Admins,OU=$OUMaster;Les membres de ce groupe assurent la maintenance et le support des postes de travail à accès privilégié de Tier0.;
|
||||
Tier 1 Servers;Tier1Servers;Security;Global;Tier 1 Servers;OU=Groupes,OU=Tier1,OU=Admins,OU=$OUMaster;Groupe contenant tous les serveurs de Tier1;
|
||||
Tier 1 Service Accounts;Tier1serviceaccounts;Security;Global;Tier 1serviceaccounts;OU=Groupes,OU=Tier1,OU=Admins,OU=$OUMaster;Groupe contenant tous les comptes de service de Tier1;
|
||||
Tier 2 Admins;tier2admins;Security;Global;Tier 2 Admins;OU=Groupes,OU=Tier2,OU=Admins,OU=$OUMaster;Les membres de ce groupe sont des administrateurs de Tier2.;
|
||||
Tier 2 Service Desk Operators;Tier2ServiceDeskOperators;Security;Global;Tier 2 Service Desk Operators;OU=Groupes,OU=Tier2,OU=Admins,OU=$OUMaster;Les membres de ce groupe sont des opérateurs du service d'assistance;
|
||||
Tier 2 Workstation Maintenance;Tier2WorkstationMaintenance;Security;Global;Tier 2 Workstation Maintenance;OU=Groupes,OU=Tier2,OU=Admins,OU=$OUMaster;Les membres de ce groupe assurent la maintenance des postes de travail;
|
||||
Tier 2 Service Accounts;Tier2serviceaccounts;Security;Global;Tier 2 Service Accounts;"OU=Groupes,OU=Tier2;OU=Admins,OU=$OUMaster;Groupe contenant tous les comptes de service de Tier2;
|
||||
"@
|
||||
|
||||
$LabelGroupesAdministrateur.Visible = $true
|
||||
Set-Content -Path $FichierGroupesAdministrateur -Value $textGroupesAdministrateur
|
||||
Write-Color -Text "[ ", "Generation du fichier : ", "Groupes-Administrateur.csv", " ]" -Color Yellow,Green,White,Yellow
|
||||
|
||||
$textGroupesStandard = @"
|
||||
Name;samAccountName;GroupCategory;GroupScope;DisplayName;OU;Description;Membership
|
||||
Test Group 1;testgroup1;Security;Global;Test Group 1;"ou=Groupes Security,OU=Ressources,OU=Groupes,OU=$OUMaster";Group with random members;
|
||||
Test Group 2;testgroup2;Security;Global;Test Group 2;"ou=Groupes Security,OU=Ressources,OU=Groupes,OU=$OUMaster";Group with random members;
|
||||
Test Group 3;testgroup3;Security;Global;Test Group 3;"ou=Groupes Security,OU=Ressources,OU=Groupes,OU=$OUMaster";Group with random members;
|
||||
Test Group 4;testgroup4;Security;Global;Test Group 4;"ou=Groupes Security,OU=Ressources,OU=Groupes,OU=$OUMaster";Group with random members;
|
||||
"@
|
||||
|
||||
$LabelGroupesStandard.Visible = $true
|
||||
Set-Content -Path $FichierGroupesStandard -Value $textGroupesStandard
|
||||
Write-Color -Text "[ ", "Generation du fichier : ", "Groupes-Standard.csv", " ]" -Color Yellow,Green,White,Yellow
|
||||
|
||||
$textOUUserPermissions = @"
|
||||
Group;OuPrefix
|
||||
Tier2ServiceDeskOperators;OU=Users,OU=$OUMaster
|
||||
Tier1Admins;OU=Accounts,ou=Tier1,ou=Admins,ou=$OUMaster
|
||||
Tier1Admins;OU=Service Accounts,ou=Tier1,ou=Admins,ou=$OUMaster
|
||||
Tier2Admins;OU=Accounts,ou=Tier2,ou=Admins,ou=$OUMaster
|
||||
Tier2Admins;OU=Service Accounts,ou=Tier2,ou=Admins,ou=$OUMaster
|
||||
"@
|
||||
|
||||
$LabelOUUserPermissions.Visible = $true
|
||||
Set-Content -Path $FichierOUUserPermissions -Value $textOUUserPermissions
|
||||
Write-Color -Text "[ ", "Generation du fichier : ", "OU-User-Permissions.csv", " ]" -Color Yellow,Green,White,Yellow
|
||||
|
||||
$textOUWorkstationPermissions = @"
|
||||
Group;OuPrefix
|
||||
Tier2ServiceDeskOperators;OU=Workstations,OU=$OUMaster
|
||||
Tier1Admins;OU=Devices,ou=Tier1,ou=Admins,ou=$OUMaster
|
||||
Tier2Admins;OU=Devices,ou=Tier2,ou=Admins,ou=$OUMaster
|
||||
"@
|
||||
|
||||
$LabelOUWorkstationPermissions.Visible = $true
|
||||
Set-Content -Path $FichierOUWorkstationPermissions -Value $textOUWorkstationPermissions
|
||||
Write-Color -Text "[ ", "Generation du fichier : ", "OU-Workstation-Permissions.csv", " ]" -Color Yellow,Green,White,Yellow
|
||||
|
||||
$textOUGroupPermissions = @"
|
||||
Group;OuPrefix
|
||||
Tier1Admins;OU=Groupes,ou=Tier1,ou=Admins,ou=$OUMaster
|
||||
Tier2Admins;OU=Groupes,ou=Tier2,ou=Admins,ou=$OUMaster
|
||||
"@
|
||||
|
||||
$LabelOUGroupPermissions.Visible = $true
|
||||
Set-Content -Path $FichierOUGroupPermissions -Value $textOUGroupPermissions
|
||||
Write-Color -Text "[ ", "Generation du fichier : ", "OU-Group-Permissions.csv", " ]" -Color Yellow,Green,White,Yellow
|
||||
|
||||
$textOUComputerPermissions = @"
|
||||
Group;OuPrefix
|
||||
Tier2WorkstationMaintenance;OU=Quarantine,ou=$OUMaster
|
||||
Tier2WorkstationMaintenance;OU=Workstations,ou=$OUMaster
|
||||
Tier1ServerMaintenance;OU=Tier 1 Servers,ou=$OUMaster
|
||||
"@
|
||||
|
||||
$LabelOUComputerPermissions.Visible = $true
|
||||
Set-Content -Path $FichierOUComputerPermissions -Value $textOUComputerPermissions
|
||||
Write-Color -Text "[ ", "Generation du fichier : ", "OU-Computer-Permissions.csv", " ]" -Color Yellow,Green,White,Yellow
|
||||
|
||||
$textOUReplicationPermissions = @"
|
||||
Group
|
||||
Tier0ReplicationMaintenance
|
||||
"@
|
||||
|
||||
$LabelOUReplicationPermissions.Visible = $true
|
||||
Set-Content -Path $FichierOUReplicationPermissions -Value $textOUReplicationPermissions
|
||||
Write-Color -Text "[ ", "Generation du fichier : ", "OU-Replication-Permissions.csv", " ]" -Color Yellow,Green,White,Yellow
|
||||
|
||||
$textOUGPOPermissions = @"
|
||||
Group;OuPrefix
|
||||
Tier1ServerMaintenance;OU=Tier 1 Servers,ou=$OUMaster
|
||||
"@
|
||||
|
||||
$LabelOUGPOPermissions.Visible = $true
|
||||
Set-Content -Path $FichierOUGPOPermissions -Value $textOUGPOPermissions
|
||||
Write-Color -Text "[ ", "Generation du fichier : ", "OU-GPO-Permissions.csv", " ]" -Color Yellow,Green,White,Yellow
|
||||
})
|
||||
|
||||
#
|
||||
#$frm.Add_load=(OnLoadForm)
|
||||
|
||||
#Shows the frame
|
||||
$frm.ShowDialog()
|
Loading…
x
Reference in New Issue
Block a user