feat: Update TS Install DCU for Dell Inc. & Update Join Domain 3e octets
This commit is contained in:
@@ -330,7 +330,7 @@ foreach ($addr in $netConfigs) {
|
||||
Write-LogMessage "Impossible de parser le 3eme octet de $ipv4" -Type "WARNING"
|
||||
continue
|
||||
}
|
||||
if ($thirdOctet -ge 1 -and $thirdOctet -le 254) {
|
||||
if ($thirdOctet -ge 0 -and $thirdOctet -le 254) {
|
||||
Write-LogMessage "IP $ipv4 est dans les plages autorisees (3eme octet = $thirdOctet). Verification statut domaine..." -Type "INFO"
|
||||
$isDomain = $false
|
||||
try {
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
powershell -noprofile -command "Set-ExecutionPolicy bypass LocalMachine"
|
||||
|
||||
#Write-host "Operating system is $OSversion"
|
||||
$kmshost = '10.0.14.20'
|
||||
Write-Host "Le serveur KSM est defini sur $kmshost"
|
||||
#Write-host "KMS client key is $Key"
|
||||
sleep -Seconds 2
|
||||
Write-host 'Forcing activation using slmgr script...'
|
||||
cscript $env:windir\System32\slmgr.vbs /skms $kmshost 2>&1
|
||||
#cscript $env:windir\System32\slmgr.vbs /ipk $key 2>&1
|
||||
cscript $env:windir\System32\slmgr.vbs /ato 2>&1
|
||||
break
|
||||
@@ -1,183 +0,0 @@
|
||||
<#
|
||||
Installation Chocolatey + logiciels
|
||||
Optimisé MDT USB / Windows 11 25H2
|
||||
Gestion timeout + retry
|
||||
#>
|
||||
|
||||
#region CONFIGURATION
|
||||
|
||||
$LogFile = "C:\Windows\Temp\choco_install.log"
|
||||
|
||||
$GlobalTimeoutMinutes = 180
|
||||
$PackageTimeoutSeconds = 2700
|
||||
$RetryCount = 2
|
||||
|
||||
$Packages = @(
|
||||
"chocolatey-core.extension",
|
||||
"chocolatey-compatibility.extension",
|
||||
"chocolatey-windowsupdate.extension",
|
||||
|
||||
"7zip.install",
|
||||
"googlechrome",
|
||||
"firefoxesr",
|
||||
"microsoft-edge",
|
||||
"notepadplusplus.install",
|
||||
"vlc.install",
|
||||
"foxitreader",
|
||||
"libreoffice-fresh",
|
||||
|
||||
"vcredist140"
|
||||
)
|
||||
|
||||
#endregion
|
||||
|
||||
#region LOGGING
|
||||
|
||||
function Write-Log {
|
||||
|
||||
param ([string]$Message)
|
||||
|
||||
$Time = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
|
||||
|
||||
$Entry = "$Time - $Message"
|
||||
|
||||
Write-Output $Entry
|
||||
Add-Content $LogFile $Entry
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region GLOBAL TIMER
|
||||
|
||||
$ScriptStartTime = Get-Date
|
||||
|
||||
function Test-GlobalTimeout {
|
||||
|
||||
$Elapsed = (Get-Date) - $ScriptStartTime
|
||||
|
||||
if ($Elapsed.TotalMinutes -gt $GlobalTimeoutMinutes) {
|
||||
|
||||
Write-Log "GLOBAL TIMEOUT atteint"
|
||||
|
||||
exit 1
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region PREREQUIS
|
||||
|
||||
Write-Log "Verification prerequis"
|
||||
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force
|
||||
|
||||
[System.Net.ServicePointManager]::SecurityProtocol =
|
||||
[System.Net.ServicePointManager]::SecurityProtocol -bor 3072
|
||||
|
||||
#endregion
|
||||
|
||||
#region INSTALL CHOCOLATEY
|
||||
|
||||
if (!(Get-Command choco -ErrorAction SilentlyContinue)) {
|
||||
|
||||
Write-Log "Installation Chocolatey"
|
||||
|
||||
Invoke-Expression (
|
||||
(New-Object System.Net.WebClient).DownloadString(
|
||||
"https://community.chocolatey.org/install.ps1"
|
||||
)
|
||||
)
|
||||
|
||||
refreshenv
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Log "Chocolatey deja installe"
|
||||
|
||||
}
|
||||
|
||||
choco feature enable -n allowGlobalConfirmation
|
||||
|
||||
#endregion
|
||||
|
||||
#region INSTALL FUNCTION WITH TIMEOUT
|
||||
|
||||
function Install-PackageWithTimeout {
|
||||
|
||||
param (
|
||||
[string]$PackageName
|
||||
)
|
||||
|
||||
for ($i = 1; $i -le $RetryCount; $i++) {
|
||||
|
||||
Test-GlobalTimeout
|
||||
|
||||
Write-Log "Installation $PackageName tentative $i"
|
||||
|
||||
$Process = Start-Process `
|
||||
choco `
|
||||
-ArgumentList "install $PackageName -y --no-progress" `
|
||||
-PassThru `
|
||||
-WindowStyle Hidden
|
||||
|
||||
if ($Process.WaitForExit($PackageTimeoutSeconds * 1000)) {
|
||||
|
||||
if ($Process.ExitCode -eq 0) {
|
||||
|
||||
Write-Log "Succes $PackageName"
|
||||
return
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Log "Erreur code $($Process.ExitCode)"
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Log "Timeout $PackageName"
|
||||
|
||||
try {
|
||||
$Process.Kill()
|
||||
}
|
||||
catch {}
|
||||
|
||||
}
|
||||
|
||||
Start-Sleep 10
|
||||
|
||||
}
|
||||
|
||||
Write-Log "Echec final $PackageName"
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region INSTALLATION PACKAGES
|
||||
|
||||
foreach ($Package in $Packages) {
|
||||
|
||||
Install-PackageWithTimeout $Package
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region UPGRADE FINAL
|
||||
|
||||
Write-Log "Upgrade global"
|
||||
|
||||
choco upgrade all -y --no-progress
|
||||
|
||||
#endregion
|
||||
|
||||
Write-Log "Script termine"
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user