Téléverser les fichiers vers "Active Directory"
This commit is contained in:
359
Active Directory/ADHealthCheck.ps1
Normal file
359
Active Directory/ADHealthCheck.ps1
Normal file
@@ -0,0 +1,359 @@
|
|||||||
|
<#PSScriptInfo
|
||||||
|
.VERSION 1.2
|
||||||
|
.GUID
|
||||||
|
.AUTHOR Hubert Cornet
|
||||||
|
.COMPANYNAME
|
||||||
|
.COPYRIGHT
|
||||||
|
.TAGS
|
||||||
|
.LICENSEURI
|
||||||
|
.PROJECTURI
|
||||||
|
.ICONURI
|
||||||
|
.EXTERNALMODULEDEPENDENCIES
|
||||||
|
.REQUIREDSCRIPTS
|
||||||
|
.EXTERNALSCRIPTDEPENDENCIES
|
||||||
|
.RELEASENOTES h
|
||||||
|
.PRIVATEDATA
|
||||||
|
#>
|
||||||
|
|
||||||
|
<#
|
||||||
|
.DESCRIPTION
|
||||||
|
Date: 18/10/2023
|
||||||
|
Active Directory Health Status Check
|
||||||
|
Satus: Ping,Netlogon,NTDS,DNS,DCdiag Test(Replication,sysvol,Services)
|
||||||
|
#>
|
||||||
|
|
||||||
|
###############################Paramters####################################
|
||||||
|
param (
|
||||||
|
[string]$Smtphost = $(Read-Host "Entrer l'addresse du serveur SMTP : "),
|
||||||
|
[string]$from = $(Read-Host "Entrer l'adresse mail de l'expéditeur : "),
|
||||||
|
[String[]]$MailReport = $(Read-Host "Entrer l'adresse mail du ou des destinataire(s) (séparés par une virgule) pour recevoir le rapport"),
|
||||||
|
$timeout = "120"
|
||||||
|
)
|
||||||
|
|
||||||
|
###########################Define Variables##################################
|
||||||
|
$MailReport = $MailReport -split ','
|
||||||
|
$Report = ".\AD-Report.htm"
|
||||||
|
|
||||||
|
If ((test-path $Report) -like $False) {
|
||||||
|
new-item $Report -type File
|
||||||
|
}
|
||||||
|
|
||||||
|
#####################################Get ALL DC Servers#######################
|
||||||
|
$GetForest = [system.directoryservices.activedirectory.Forest]::GetCurrentForest()
|
||||||
|
$DCServers = $getForest.domains | ForEach-Object {$_.DomainControllers} | ForEach-Object {$_.Name}
|
||||||
|
|
||||||
|
###############################HTml Report Content############################
|
||||||
|
Clear-Content $Report
|
||||||
|
|
||||||
|
Add-Content $Report "<html>"
|
||||||
|
Add-Content $Report " <head>"
|
||||||
|
Add-Content $Report " <meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>"
|
||||||
|
Add-Content $Report ' <title> Rapport Status Active Directory </title>'
|
||||||
|
Add-Content $Report ' <STYLE TYPE="text/css">'
|
||||||
|
Add-Content $Report " <!--"
|
||||||
|
Add-Content $Report " td {"
|
||||||
|
Add-Content $Report " font-family: Tahoma;"
|
||||||
|
Add-Content $Report " font-size: 11px;"
|
||||||
|
Add-Content $Report " border-top: 1px solid #999999;"
|
||||||
|
Add-Content $Report " border-right: 1px solid #999999;"
|
||||||
|
Add-Content $Report " border-bottom: 1px solid #999999;"
|
||||||
|
Add-Content $Report " border-left: 1px solid #999999;"
|
||||||
|
Add-Content $Report " padding-top: 0px;"
|
||||||
|
Add-Content $Report " padding-right: 0px;"
|
||||||
|
Add-Content $Report " padding-bottom: 0px;"
|
||||||
|
Add-Content $Report " padding-left: 0px;"
|
||||||
|
Add-Content $Report " }"
|
||||||
|
Add-Content $Report " body {"
|
||||||
|
Add-Content $Report " margin-left: 5px;"
|
||||||
|
Add-Content $Report " margin-top: 5px;"
|
||||||
|
Add-Content $Report " margin-right: 0px;"
|
||||||
|
Add-Content $Report " margin-bottom: 10px;"
|
||||||
|
Add-Content $Report " }"
|
||||||
|
Add-Content $Report " table {"
|
||||||
|
Add-Content $Report " border: thin solid #000000;"
|
||||||
|
Add-Content $Report " }"
|
||||||
|
Add-Content $Report " -->"
|
||||||
|
Add-Content $Report " </style>"
|
||||||
|
Add-Content $Report " </head>"
|
||||||
|
Add-Content $Report " <body>"
|
||||||
|
Add-Content $Report " <table width='100%'>"
|
||||||
|
Add-Content $Report " <tr bgcolor='Lavender'>"
|
||||||
|
Add-Content $Report " <td colspan='7' height='25' align='center'>"
|
||||||
|
Add-Content $Report " <font face='tahoma' color='#003399' size='4'><strong> Active Directory Check Health </strong></font>"
|
||||||
|
Add-Content $Report " </td>"
|
||||||
|
Add-Content $Report " </tr>"
|
||||||
|
Add-Content $Report " </table>"
|
||||||
|
|
||||||
|
Add-Content $Report " <table width='100%'>"
|
||||||
|
Add-Content $Report " <tr bgcolor='IndianRed'>"
|
||||||
|
Add-Content $Report " <td width='5%' align='center'><B> Identite </B></td>"
|
||||||
|
Add-Content $Report " <td width='10%' align='center'><B> Status du ping </B></td>"
|
||||||
|
Add-Content $Report " <td width='10%' align='center'><B> Service Netlogon </B></td>"
|
||||||
|
Add-Content $Report " <td width='10%' align='center'><B> Service NTDS </B></td>"
|
||||||
|
Add-Content $Report " <td width='10%' align='center'><B> Status Service DNS </B></td>"
|
||||||
|
Add-Content $Report " <td width='10%' align='center'><B> Test Netlogons </B></td>"
|
||||||
|
Add-Content $Report " <td width='10%' align='center'><B> Test Replication </B></td>"
|
||||||
|
Add-Content $Report " <td width='10%' align='center'><B> Test Services </B></td>"
|
||||||
|
Add-Content $Report " <td width='10%' align='center'><B> Test Advertising </B></td>"
|
||||||
|
Add-Content $Report " <td width='10%' align='center'><B> Test Check FSMO </B></td>"
|
||||||
|
Add-Content $Report " </tr>"
|
||||||
|
|
||||||
|
################Ping Test################################################################
|
||||||
|
Foreach ($DC in $DCServers) {
|
||||||
|
$Identity = $DC
|
||||||
|
Add-Content $Report " <tr>"
|
||||||
|
|
||||||
|
If ( Test-Connection -ComputerName $DC -Count 1 -ErrorAction SilentlyContinue ) {
|
||||||
|
Write-Host $DC `t $DC `t Ping Success -ForegroundColor Green
|
||||||
|
|
||||||
|
Add-Content $Report " <td bgcolor= 'GainsBoro' align=center><B> $Identity </B></td>"
|
||||||
|
Add-Content $Report " <td bgcolor= 'Aquamarine' align=center><B> OkK </B></td>"
|
||||||
|
|
||||||
|
##############Netlogon Service Status################
|
||||||
|
$serviceStatus = start-job -scriptblock {get-service -ComputerName $($args[0]) -Name "Netlogon" -ErrorAction SilentlyContinue} -ArgumentList $DC
|
||||||
|
Wait-Job $serviceStatus -timeout $timeout
|
||||||
|
|
||||||
|
If ($serviceStatus.state -like "Running") {
|
||||||
|
Write-Host $DC `t Netlogon Service TimeOut -ForegroundColor Yellow
|
||||||
|
Add-Content $Report " <td bgcolor= 'Yellow' align=center><B> Timeout Netlogon </B></td>"
|
||||||
|
Stop-Job $serviceStatus
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
$serviceStatus1 = Receive-job $serviceStatus
|
||||||
|
If ($serviceStatus1.status -eq "Running") {
|
||||||
|
Write-Host $DC `t $serviceStatus1.name `t $serviceStatus1.status -ForegroundColor Green
|
||||||
|
|
||||||
|
$svcName = $serviceStatus1.name
|
||||||
|
$svcState = $serviceStatus1.status
|
||||||
|
|
||||||
|
Add-Content $Report " <td bgcolor= 'Aquamarine' align=center><B> $svcState </B></td>"
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
Write-Host $DC `t $serviceStatus1.name `t $serviceStatus1.status -ForegroundColor Red
|
||||||
|
|
||||||
|
$svcName = $serviceStatus1.name
|
||||||
|
$svcState = $serviceStatus1.status
|
||||||
|
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> $svcState </B></td>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
##############NTDS Service Status################
|
||||||
|
$serviceStatus = start-job -scriptblock {get-service -ComputerName $($args[0]) -Name "NTDS" -ErrorAction SilentlyContinue} -ArgumentList $DC
|
||||||
|
Wait-Job $serviceStatus -timeout $timeout
|
||||||
|
|
||||||
|
If ($serviceStatus.state -like "Running") {
|
||||||
|
Write-Host $DC `t NTDS Service TimeOut -ForegroundColor Yellow
|
||||||
|
Add-Content $Report " <td bgcolor= 'Yellow' align=center><B> Timeout NTDS </B></td>"
|
||||||
|
Stop-Job $serviceStatus
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
$serviceStatus1 = Receive-job $serviceStatus
|
||||||
|
|
||||||
|
If ($serviceStatus1.status -eq "Running") {
|
||||||
|
Write-Host $DC `t $serviceStatus1.name `t $serviceStatus1.status -ForegroundColor Green
|
||||||
|
|
||||||
|
$svcName = $serviceStatus1.name
|
||||||
|
$svcState = $serviceStatus1.status
|
||||||
|
|
||||||
|
Add-Content $Report " <td bgcolor= 'Aquamarine' align=center><B> $svcState </B></td>"
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
Write-Host $DC `t $serviceStatus1.name `t $serviceStatus1.status -ForegroundColor Red
|
||||||
|
|
||||||
|
$svcName = $serviceStatus1.name
|
||||||
|
$svcState = $serviceStatus1.status
|
||||||
|
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> $svcState </B></td>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
##############DNS Service Status################
|
||||||
|
$serviceStatus = start-job -scriptblock {get-service -ComputerName $($args[0]) -Name "DNS" -ErrorAction SilentlyContinue} -ArgumentList $DC
|
||||||
|
|
||||||
|
Wait-Job $serviceStatus -timeout $timeout
|
||||||
|
|
||||||
|
If ($serviceStatus.state -like "Running") {
|
||||||
|
Write-Host $DC `t DNS Server Service TimeOut -ForegroundColor Yellow
|
||||||
|
Add-Content $Report " <td bgcolor= 'Yellow' align=center><B> Timeout DNS </B></td>"
|
||||||
|
Stop-Job $serviceStatus
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
$serviceStatus1 = Receive-job $serviceStatus
|
||||||
|
|
||||||
|
If ($serviceStatus1.status -eq "Running") {
|
||||||
|
Write-Host $DC `t $serviceStatus1.name `t $serviceStatus1.status -ForegroundColor Green
|
||||||
|
|
||||||
|
$svcName = $serviceStatus1.name
|
||||||
|
$svcState = $serviceStatus1.status
|
||||||
|
|
||||||
|
Add-Content $Report " <td bgcolor= 'Aquamarine' align=center><B> $svcState </B></td>"
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
Write-Host $DC `t $serviceStatus1.name `t $serviceStatus1.status -ForegroundColor Red
|
||||||
|
|
||||||
|
$svcName = $serviceStatus1.name
|
||||||
|
$svcState = $serviceStatus1.status
|
||||||
|
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> $svcState </B></td>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
####################Netlogons status##################
|
||||||
|
Add-Type -AssemblyName microsoft.visualbasic
|
||||||
|
|
||||||
|
$cmp = "microsoft.visualbasic.strings" -as [type]
|
||||||
|
$sysvol = start-job -scriptblock {dcdiag /test:netlogons /s:$($args[0])} -ArgumentList $DC
|
||||||
|
|
||||||
|
Wait-Job $sysvol -timeout $timeout
|
||||||
|
|
||||||
|
If ($sysvol.state -like "Running") {
|
||||||
|
Write-Host $DC `t Netlogons Test TimeOut -ForegroundColor Yellow
|
||||||
|
Add-Content $Report " <td bgcolor= 'Yellow' align=center><B> Timeout Netlogons </B></td>"
|
||||||
|
Stop-Job $sysvol
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
$sysvol1 = Receive-job $sysvol
|
||||||
|
|
||||||
|
If ($cmp::instr($sysvol1, "passed test NetLogons")) {
|
||||||
|
Write-Host $DC `t Netlogons Test passed -ForegroundColor Green
|
||||||
|
Add-Content $Report " <td bgcolor= 'Aquamarine' align=center><B> Netlogons OK </B></td>"
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
Write-Host $DC `t Netlogons Test Failed -ForegroundColor Red
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Netlogons Echec </B></td>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
####################Replications status##################
|
||||||
|
Add-Type -AssemblyName microsoft.visualbasic
|
||||||
|
|
||||||
|
$cmp = "microsoft.visualbasic.strings" -as [type]
|
||||||
|
$sysvol = start-job -scriptblock {dcdiag /test:Replications /s:$($args[0])} -ArgumentList $DC
|
||||||
|
|
||||||
|
Wait-Job $sysvol -timeout $timeout
|
||||||
|
If ($sysvol.state -like "Running") {
|
||||||
|
Write-Host $DC `t Replications Test TimeOut -ForegroundColor Yellow
|
||||||
|
Add-Content $Report " <td bgcolor= 'Yellow' align=center><B> Timeout Replications </B></td>"
|
||||||
|
Stop-Job $sysvol
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
$sysvol1 = Receive-job $sysvol
|
||||||
|
|
||||||
|
If ($cmp::instr($sysvol1, "passed test Replications")) {
|
||||||
|
Write-Host $DC `t Replications Test passed -ForegroundColor Green
|
||||||
|
Add-Content $Report " <td bgcolor= 'Aquamarine' align=center><B> Replications OK </B></td>"
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
Write-Host $DC `t Replications Test Failed -ForegroundColor Red
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Replications Echec </B></td>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
####################Services status##################
|
||||||
|
Add-Type -AssemblyName microsoft.visualbasic
|
||||||
|
|
||||||
|
$cmp = "microsoft.visualbasic.strings" -as [type]
|
||||||
|
$sysvol = start-job -scriptblock {dcdiag /test:Services /s:$($args[0])} -ArgumentList $DC
|
||||||
|
|
||||||
|
Wait-Job $sysvol -timeout $timeout
|
||||||
|
|
||||||
|
If ($sysvol.state -like "Running") {
|
||||||
|
Write-Host $DC `t Services Test TimeOut -ForegroundColor Yellow
|
||||||
|
Add-Content $Report " <td bgcolor= 'Yellow' align=center><B> Timeout Services </B></td>"
|
||||||
|
Stop-Job $sysvol
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
$sysvol1 = Receive-job $sysvol
|
||||||
|
|
||||||
|
If ($cmp::instr($sysvol1, "passed test Services")) {
|
||||||
|
Write-Host $DC `t Services Test passed -ForegroundColor Green
|
||||||
|
Add-Content $Report " <td bgcolor= 'Aquamarine' align=center><B> Services OK</B></td>"
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
Write-Host $DC `t Services Test Failed -ForegroundColor Red
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Services Echec </B></td>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
####################Advertising status##################
|
||||||
|
Add-Type -AssemblyName microsoft.visualbasic
|
||||||
|
|
||||||
|
$cmp = "microsoft.visualbasic.strings" -as [type]
|
||||||
|
$sysvol = start-job -scriptblock {dcdiag /test:Advertising /s:$($args[0])} -ArgumentList $DC
|
||||||
|
|
||||||
|
Wait-Job $sysvol -timeout $timeout
|
||||||
|
|
||||||
|
If ($sysvol.state -like "Running") {
|
||||||
|
Write-Host $DC `t Advertising Test TimeOut -ForegroundColor Yellow
|
||||||
|
Add-Content $Report " <td bgcolor= 'Yellow' align=center><B> Advertising Timeout </B></td>"
|
||||||
|
Stop-Job $sysvol
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
$sysvol1 = Receive-job $sysvol
|
||||||
|
|
||||||
|
If ($cmp::instr($sysvol1, "passed test Advertising")) {
|
||||||
|
Write-Host $DC `t Advertising Test passed -ForegroundColor Green
|
||||||
|
Add-Content $Report " <td bgcolor= 'Aquamarine' align=center><B> Advertising OK </B></td>"
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
Write-Host $DC `t Advertising Test Failed -ForegroundColor Red
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Advertising Echec </B></td>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
####################FSMOCheck status##################
|
||||||
|
Add-Type -AssemblyName microsoft.visualbasic
|
||||||
|
|
||||||
|
$cmp = "microsoft.visualbasic.strings" -as [type]
|
||||||
|
$sysvol = start-job -scriptblock {dcdiag /test:FSMOCheck /s:$($args[0])} -ArgumentList $DC
|
||||||
|
|
||||||
|
Wait-Job $sysvol -timeout $timeout
|
||||||
|
|
||||||
|
If ($sysvol.state -like "Running") {
|
||||||
|
Write-Host $DC `t FSMOCheck Test TimeOut -ForegroundColor Yellow
|
||||||
|
Add-Content $Report " <td bgcolor= 'Yellow' align=center><B> Timeout Check FSMO </B></td>"
|
||||||
|
Stop-Job $sysvol
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
$sysvol1 = Receive-job $sysvol
|
||||||
|
|
||||||
|
If ($cmp::instr($sysvol1, "passed test FsmoCheck")) {
|
||||||
|
Write-Host $DC `t FSMOCheck Test passed -ForegroundColor Green
|
||||||
|
Add-Content $Report " <td bgcolor= 'Aquamarine' align=center><B>Check FSMO OK </B></td>"
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
Write-Host $DC `t FSMOCheck Test Failed -ForegroundColor Red
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Check FSMO Echec </B></td>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Else {
|
||||||
|
Write-Host $DC `t $DC `t Ping Fail -ForegroundColor Red
|
||||||
|
Add-Content $Report " <td bgcolor= 'GainsBoro' align=center> <B> $Identity </B></td>"
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Ping Echec </B></td>"
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Ping Echec </B></td>"
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Ping Echec </B></td>"
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Ping Echec </B></td>"
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Ping Echec </B></td>"
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Ping Echec </B></td>"
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Ping Echec </B></td>"
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Ping Echec </B></td>"
|
||||||
|
Add-Content $Report " <td bgcolor= 'Red' align=center><B> Ping Echec </B></td>"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Add-Content $Report " </tr>"
|
||||||
|
|
||||||
|
############################################Close HTMl Tables###########################
|
||||||
|
Add-Content $Report " </table>"
|
||||||
|
Add-Content $Report " </body>"
|
||||||
|
Add-Content $Report "</html>"
|
||||||
|
|
||||||
|
|
||||||
|
#############################################Send Email#################################
|
||||||
|
If (($Smtphost) -and ($MailReport) -and ($From)) {
|
||||||
|
[string]$body = Get-Content $Report
|
||||||
|
Send-MailMessage -SmtpServer $Smtphost -From $From -To $MailReport -Subject "Active Directory Health Monitor" -Body $body -BodyAsHtml
|
||||||
|
}
|
||||||
|
|
6
Active Directory/Import-AdGroups.csv
Normal file
6
Active Directory/Import-AdGroups.csv
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
Utilisateur;Commun;Commerce;Achats;Direction;Marketing;Technique
|
||||||
|
p.dupont;2;2;2;2;2;2
|
||||||
|
b.durand;2;;2;;2;2
|
||||||
|
d.bellier;2;1;2;;;
|
||||||
|
j.tartas;2;;;;1;2
|
||||||
|
b.canu;2;;;;1;2
|
|
6
Active Directory/Import-AdUsers.csv
Normal file
6
Active Directory/Import-AdUsers.csv
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
firstname;lastname;username;email;streetaddress;city;state;department;password;telephone;jobtitle;company;ou
|
||||||
|
Paul;Dupont;p.dupont;p.dupont@hitea.fr;;Agen;;;Test123Test1;;;;OU=Utilisateurs,OU=Agen,DC=dom,DC=hitea,DC=fr
|
||||||
|
Bernard;Durand;b.durand;b.durand@hitea.fr;;Agen;;;Test123Test2;;;;OU=Utilisateurs,OU=Agen,DC=dom,DC=hitea,DC=fr
|
||||||
|
David;Bellier;d.bellier;d.bellier@hitea.fr;;Agen;;;Test123Test3;;;;OU=Utilisateurs,OU=Agen,DC=dom,DC=hitea,DC=fr
|
||||||
|
Joël;Tartas;j.tartas;j.tartas@hitea.fr;;Agen;;;Test123Test4;;;;OU=Utilisateurs,OU=Agen,DC=dom,DC=hitea,DC=fr
|
||||||
|
Benoît;Canu;b.canu;b.canu@hitea.fr;;Agen;;;Test123Test5;;;;OU=Utilisateurs,OU=Agen,DC=dom,DC=hitea,DC=fr
|
|
48
Active Directory/List-All-Ressources.ps1
Normal file
48
Active Directory/List-All-Ressources.ps1
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
$DNSServer = "10.78.56.8"
|
||||||
|
|
||||||
|
$Zones = @(Get-DnsServerZone -ComputerName $DNSServer)
|
||||||
|
$Data = @()
|
||||||
|
ForEach ($Zone in $Zones) {
|
||||||
|
($Zone | Get-DnsServerResourceRecord -ComputerName $DNSServer) | `
|
||||||
|
Select-Object -Property `
|
||||||
|
@{Label="Zone Name";expression={( $Zone.ZoneName )}},`
|
||||||
|
DistinguishedName,`
|
||||||
|
HostName,`
|
||||||
|
RecordClass,`
|
||||||
|
RecordType,`
|
||||||
|
Timestamp,`
|
||||||
|
TimeToLive,`
|
||||||
|
@{label="Data";expression={
|
||||||
|
$r = $_.RecordData
|
||||||
|
switch ($_.RecordType)
|
||||||
|
{
|
||||||
|
"A" { $r.IPv4Address.IPAddressToString }
|
||||||
|
"NS" { $r.NameServer }
|
||||||
|
"SOA" {
|
||||||
|
"ExpireLimit=$($r.ExpireLimit);"+
|
||||||
|
"MinimumTimeToLive=$($r.MinimumTimeToLive);"+
|
||||||
|
"PrimaryServer=$($r.PrimaryServer);"+
|
||||||
|
"RefreshInterval=$($r.RefreshInterval);"+
|
||||||
|
"ResponsiblePerson=$($r.ResponsiblePerson);"+
|
||||||
|
"RetryDelay=$($r.RetryDelay);"+
|
||||||
|
"SerialNumber=$($r.SerialNumber)"
|
||||||
|
|
||||||
|
}
|
||||||
|
"CNAME" { $r.HostNameAlias }
|
||||||
|
"SRV"{
|
||||||
|
"DomainName=$($r.DomainName);"+
|
||||||
|
"Port=$($r.Port);"+
|
||||||
|
"Priority=$($r.Priority);"+
|
||||||
|
"Weight=$($r.Weight)"
|
||||||
|
}
|
||||||
|
"AAAA" { $r.IPv6Address.IPAddressToString }
|
||||||
|
"PTR" { $r.PtrDomainName }
|
||||||
|
"MX" {
|
||||||
|
"MailExchange=$($r.MailExchange);"+
|
||||||
|
"Prefreence=$($r.Preference)"
|
||||||
|
}
|
||||||
|
"TXT" { $r.DescriptiveText }
|
||||||
|
Default { "Unsupported Record Type" }
|
||||||
|
}}
|
||||||
|
}
|
||||||
|
}
|
8325
Active Directory/Reset-KrbTgt-Password-For-RWDCs-And-RODCs.ps1
Normal file
8325
Active Directory/Reset-KrbTgt-Password-For-RWDCs-And-RODCs.ps1
Normal file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,81 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<resetKrbTgtPassword xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||||
|
<!-- FQDN Of The Mail Server Or Mail Relay -->
|
||||||
|
<smtpServer>REPLACE_WITH_MAIL_SERVER_FQDN</smtpServer>
|
||||||
|
|
||||||
|
<!-- SMTP Port To Use -->
|
||||||
|
<smtpPort>REPLACE_WITH_MAIL_SERVER_SMTP_PORT_NUMERIC_VALUE</smtpPort>
|
||||||
|
|
||||||
|
<!-- SSL FOR SMTP - TRUE OR FALSE -->
|
||||||
|
<useSSLForSMTP>TRUE_OR_FALSE</useSSLForSMTP>
|
||||||
|
|
||||||
|
<!-- SSL TYPE - EXPLICIT OR IMPLICIT, BUT ONLY WHEN useSSLForSMTP = TRUE -->
|
||||||
|
<sslType>IMPLICIT_OR_EXPLICIT</sslType>
|
||||||
|
|
||||||
|
<!-- SMTP Credentials To Use - UserName/Password -->
|
||||||
|
<smtpCredsUserName>LEAVE_EMPTY_OR_LEAVE_AS_IS_OR_REPLACE_WITH_USERNAME_IF_USED</smtpCredsUserName>
|
||||||
|
<smtpCredsPassword>LEAVE_EMPTY_OR_LEAVE_AS_IS_OR_REPLACE_WITH_PASSWORD_IF_USED</smtpCredsPassword>
|
||||||
|
|
||||||
|
<!-- Mail Subject To Use -->
|
||||||
|
<mailSubject>KrbTgt Password Reset Result</mailSubject>
|
||||||
|
|
||||||
|
<!-- The Priority Of The Message: Low, Normal, High -->
|
||||||
|
<mailPriority>High</mailPriority>
|
||||||
|
|
||||||
|
<!-- Mail Body To Use -->
|
||||||
|
<mailBody>
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>KrbTgt_Password_Reset</title>
|
||||||
|
<style type="text/css">
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<B><P align="center" style="font-size: 24pt; font-family: Arial Narrow, sans-serif; color: red">!!! ATTENTION | FYI - ACTION REQUIRED !!!</P></B>
|
||||||
|
<hr size=2 width="95%" align=center>
|
||||||
|
<BR>
|
||||||
|
<P style="font-size: 12pt; font-family: Arial Narrow, sans-serif;">Hello,</P>
|
||||||
|
<BR>
|
||||||
|
<P style="font-size: 12pt; font-family: Arial Narrow, sans-serif;">Please review the attached log file.</P>
|
||||||
|
<BR>
|
||||||
|
<P style="font-size: 12pt; font-family: Arial Narrow, sans-serif;">Best regards</P>
|
||||||
|
</body>
|
||||||
|
</html></mailBody>
|
||||||
|
|
||||||
|
<!-- The SMTP Address Used In The FROM Field -->
|
||||||
|
<mailFromSender>sender_Mail_Address@company.com</mailFromSender>
|
||||||
|
|
||||||
|
<!-- The SMTP Address Used In The TO Field -->
|
||||||
|
<mailToRecipient>recipient_To_MailAddress@company.com</mailToRecipient>
|
||||||
|
|
||||||
|
<!-- The SMTP Address Used In The CC Field -->
|
||||||
|
<mailCcRecipients>
|
||||||
|
<!-- For Every Recipient To Be Added In The CC Add A New Line -->
|
||||||
|
<mailCcRecipient>recipient_Cc_MailAddress_1@company.com</mailCcRecipient>
|
||||||
|
<mailCcRecipient>recipient_Cc_MailAddress_2@company.com</mailCcRecipient>
|
||||||
|
</mailCcRecipients>
|
||||||
|
|
||||||
|
<!-- Enable/Disable SMIME signing and encryptionof emails: ON or OFF -->
|
||||||
|
<mailSign>OFF</mailSign>
|
||||||
|
<mailEncrypt>OFF</mailEncrypt>
|
||||||
|
|
||||||
|
<!-- Full path of Cpi.Net.SecureMail.dll -->
|
||||||
|
<!-- Dll Source Code: https://www.codeproject.com/Articles/41727/An-S-MIME-Library-for-Sending-Signed-and-Encrypted -->
|
||||||
|
<mailSignAndEncryptDllFile>REPLACE_WITH_FULL_FOLDER_PATH_TO_COMPILED_DLL_FILE\Cpi.Net.SecureMail.dll</mailSignAndEncryptDllFile>
|
||||||
|
|
||||||
|
<!-- Location Of Cert To Sign/Encrypt The Mail -->
|
||||||
|
<mailSignAndEncryptCertLocation>STORE_OR_PFX</mailSignAndEncryptCertLocation> <!-- Location Of Cert To Sign/Encrypt The Mail - Options Are: PFX or STORE -->
|
||||||
|
<mailEncryptCertLocation>STORE_OR_CER</mailEncryptCertLocation> <!-- Location Of Cert To Encrypt The Mail - Options Are: CER or STORE -->
|
||||||
|
|
||||||
|
<!-- Thumbprint Of Certificate To Sign/Encrypt Mail With - Only Used When Corresponding Value For Location Is STORE -->
|
||||||
|
<mailSignAndEncryptCertThumbprint>LEAVE_EMPTY_OR_LEAVE_AS_IS_OR_REPLACE_WITH_THUMBPRINT_IF_USED</mailSignAndEncryptCertThumbprint> <!-- Thumbprint Of Cert To Sign/Encrypt The Mail By Sender -->
|
||||||
|
<mailEncryptCertThumbprint>LEAVE_EMPTY_OR_LEAVE_AS_IS_OR_REPLACE_WITH_THUMBPRINT_IF_USED</mailEncryptCertThumbprint> <!-- Thumbprint Of Cert To Encrypt The Mail For Recipient -->
|
||||||
|
|
||||||
|
<!-- Full path of a .pfx/.cer certificate file used to sign/encrypt the email message - Only Used When Corresponding Value For Location Is PFX/CER -->
|
||||||
|
<mailSignAndEncryptCertPFXFile>REPLACE_WITH_FULL_FOLDER_PATH_TO_PFX_FILE\cert.pfx</mailSignAndEncryptCertPFXFile> <!-- PFX File Of Cert/Private Key To Sign/Encrypt The Mail By Sender -->
|
||||||
|
<mailEncryptCertCERFile>REPLACE_WITH_FULL_FOLDER_PATH_TO_CER_FILE\cert.cer</mailEncryptCertCERFile> <!-- CER File Of Cert To Encrypt The Mail For Recipient -->
|
||||||
|
|
||||||
|
<!-- The password for the .pfx certificate file - Only Used When Corresponding Value For Location Is PFX -->
|
||||||
|
<mailSignAndEncryptCertPFXPassword>LEAVE_EMPTY_OR_LEAVE_AS_IS_OR_REPLACE_WITH_PFX_PASSWORD_IF_USED</mailSignAndEncryptCertPFXPassword> <!-- Password Of PFX File Of Cert/Private Key To Sign/Encrypt The Mail By Sender -->
|
||||||
|
</resetKrbTgtPassword>
|
3
Active Directory/copier-groupe-ad.ps1
Normal file
3
Active Directory/copier-groupe-ad.ps1
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
|
Get-ADGroupMember "<GROUPE-DESTINATION>" | Get-ADUser | ForEach-Object {Add-ADGroupMember -Identity "<GROUPE-SOURCE>" -Members $_}
|
Reference in New Issue
Block a user