Ajout dela structure MDT dans Infra-LAB
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
#Import-Module "C:\MININT\Modules\Microsoft.BDD.TaskSequenceModule"
|
||||
#Import-Module "C:\MININT\Modules\ZTIUtility"
|
||||
|
||||
Write-Progress -Activity "Sending email" -Status "Getting Information" -PercentComplete 25 -Id 1
|
||||
|
||||
$NewMsg = new-object Net.Mail.MailMessage
|
||||
$SMTP = new-object Net.Mail.SmtpClient($tsenv:OSDSendMailSMTPServer)
|
||||
|
||||
Write-Progress -Activity "Sending email" -Status "Creating Email" -PercentComplete 50 -Id 1
|
||||
|
||||
$Get_Monitoring = Get_My_MonitoringData -path DSManager: | where {$_.name -eq $MyComputer}
|
||||
$Start = $Get_Monitoring.StartTime
|
||||
$End = $Get_Monitoring.EndTime
|
||||
$LastTime = $Get_Monitoring.LastTime
|
||||
$WarningNB = $Get_Monitoring.warnings
|
||||
$ErrorNB = $Get_Monitoring.Errors
|
||||
$step = $Get_Monitoring.StepName
|
||||
$Percentage = $Get_Monitoring.PercentComplete
|
||||
$step = $Get_Monitoring
|
||||
|
||||
$InfosEtab = Get-InfosEtab
|
||||
$NomLycee = $InfosEtab.NomLycee
|
||||
|
||||
#On récupère les infos WSUS sur le client
|
||||
$Key = "HKLM:\SOFTWARE\Policies\Microsoft\windows\WindowsUpdate"
|
||||
$TargetGroup = Get-ItemPropertyValue $Key -Name "TargetGroup"
|
||||
$WUServer = Get-ItemPropertyValue $Key -Name "WUServer"
|
||||
$WUStatusServer = Get-ItemPropertyValue $Key -Name "WUStatusServer"
|
||||
|
||||
#On récupère les infos Kaspsersky sur le client
|
||||
$Key_KSC = "HKLM:\SOFTWARE\Wow6432Node\KasperskyLab\Components\34\1103\1.0.0.0\Statistics\AVState"
|
||||
$KSC_IP = Get-ItemPropertyValue $Key_KSC -Name "Protection_AdmServer"
|
||||
$KSC_AV = Get-ItemPropertyValue $Key_KSC -Name "Protection_AvInstalled"
|
||||
|
||||
if ( $KSC_AV = "1" )
|
||||
{
|
||||
$KSC_AV = "Oui"
|
||||
}
|
||||
Else
|
||||
{
|
||||
$KSC_AV = "Non"
|
||||
}
|
||||
|
||||
$NewMsg.IsBodyHTML = $true
|
||||
$NewMsg.From = "$tsenv:OSDSENDMAILFROM"
|
||||
$NewMsg.To.Add($tsenv:OSDSendMailToPri)
|
||||
$NewMsg.CC.Add($tsenv:OSDSendMailToSec)
|
||||
$NewMsg.Subject = "Notification from the OS Deployment solution"
|
||||
$NewMsg.Body = "<p>
|
||||
<span>Bonjour,<br><br>
|
||||
Déploiement de Système d'Exploitation <strong><span style=color:green>est fini avec succès</span></strong> sur l'ordinateur: <span style=color:blue><strong>$env:COMPUTERNAME</strong></span> - $(get-date)
|
||||
<br><br>
|
||||
<span style=color:black>
|
||||
Voir ci-dessous quelques informations sur votre déploiement :
|
||||
<br><br>
|
||||
<strong>Lycée: </strong>$NomLycee
|
||||
<br>
|
||||
<strong>Nom Ordinateur: </strong>$env:COMPUTERNAME
|
||||
<br>
|
||||
<strong>TaskSequenceName: </strong>$TSEnv:TASKSEQUENCENAME
|
||||
<br>
|
||||
<strong>Vendor: </strong>$TSEnv:Make
|
||||
<br>
|
||||
<strong>Model: </strong>$TSEnv:Model
|
||||
<br>
|
||||
<strong>Memory: </strong>$TSEnv:Memory Megabyte
|
||||
<br>
|
||||
<strong>SerialNumber: </strong>$TSEnv:SerialNumber
|
||||
<br>
|
||||
<strong>AssetTag: </strong>$TSEnv:AssetTag
|
||||
<br>
|
||||
<strong>Start time: </strong>$Start
|
||||
<br>
|
||||
<strong>End time: </strong>$End
|
||||
<br>
|
||||
<strong>Warning: </strong>$WarningNB
|
||||
<br>
|
||||
<strong>Error: </strong>$ErrorNB
|
||||
<br>
|
||||
<strong>Groupe WSUS: </strong>$TargetGroup
|
||||
<br>
|
||||
<strong>WUServer: </strong>$WUServer
|
||||
<br>
|
||||
<strong>WUStatusServer: </strong>$WUStatusServer
|
||||
<br>
|
||||
<strong>Serveur Kaspsersky: </strong>$KSC_IP
|
||||
<br>
|
||||
<strong>Antivirus Installé: </strong>$KSC_AV
|
||||
<br><br>
|
||||
Meilleures salutations.
|
||||
</span>
|
||||
</span></p>
|
||||
"
|
||||
|
||||
if ($tsenv:OSDSendMailIncludeBDDLog -eq "YES"){
|
||||
$AttachToMail001 = new-object Net.Mail.Attachment($tsenv:LOGPATH + "\BDD.log")
|
||||
$NewMsg.Attachments.Add($AttachToMail001)
|
||||
}
|
||||
|
||||
Write-Progress -Activity "Sending email" -Status "Sending email to $tsenv:OSDSendMailToPri" -PercentComplete 75 -Id 1
|
||||
Start-Sleep 1
|
||||
$NewMsg
|
||||
$SMTP.Send($NewMsg)
|
||||
|
||||
if ($OSDSendMailIncludeBDDLog -eq "YES"){$AttachToMail.Dispose()}
|
||||
|
||||
Write-Progress -Activity "Sending email" -Status "Done" -PercentComplete 100 -Id 1
|
||||
Reference in New Issue
Block a user