From 70996ad39389ce261cfddec4502617e210a343fe Mon Sep 17 00:00:00 2001 From: Tom LAVEILLE Date: Mon, 7 Oct 2024 08:54:23 +0200 Subject: [PATCH] =?UTF-8?q?T=C3=A9l=C3=A9verser=20les=20fichiers=20vers=20?= =?UTF-8?q?"Panther/InstalCustome"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Panther/InstalCustome/Layout.xml | 31 +++++++ Panther/InstalCustome/Set-WindowState.ps1 | 75 +++++++++++++++++ Panther/InstalCustome/SetupAdmin.ps1 | 81 +++++++++++++++++++ Panther/InstalCustome/SetupPChosts.bat | 17 ++++ .../SoftwareLicensingService.bat | 8 ++ 5 files changed, 212 insertions(+) create mode 100644 Panther/InstalCustome/Layout.xml create mode 100644 Panther/InstalCustome/Set-WindowState.ps1 create mode 100644 Panther/InstalCustome/SetupAdmin.ps1 create mode 100644 Panther/InstalCustome/SetupPChosts.bat create mode 100644 Panther/InstalCustome/SoftwareLicensingService.bat diff --git a/Panther/InstalCustome/Layout.xml b/Panther/InstalCustome/Layout.xml new file mode 100644 index 0000000..2b45984 --- /dev/null +++ b/Panther/InstalCustome/Layout.xml @@ -0,0 +1,31 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Panther/InstalCustome/Set-WindowState.ps1 b/Panther/InstalCustome/Set-WindowState.ps1 new file mode 100644 index 0000000..843e884 --- /dev/null +++ b/Panther/InstalCustome/Set-WindowState.ps1 @@ -0,0 +1,75 @@ +function Set-WindowState { + <# + .LINK + https://gist.github.com/Nora-Ballard/11240204 + #> + + [CmdletBinding(DefaultParameterSetName = 'InputObject')] + param( + [Parameter(Position = 0, Mandatory = $true, ValueFromPipeline = $true)] + [Object[]] $InputObject, + + [Parameter(Position = 1)] + [ValidateSet('FORCEMINIMIZE', 'HIDE', 'MAXIMIZE', 'MINIMIZE', 'RESTORE', + 'SHOW', 'SHOWDEFAULT', 'SHOWMAXIMIZED', 'SHOWMINIMIZED', + 'SHOWMINNOACTIVE', 'SHOWNA', 'SHOWNOACTIVATE', 'SHOWNORMAL')] + [string] $State = 'SHOW', + [switch] $SuppressErrors = $false, + [switch] $SetForegroundWindow = $false + ) + + Begin { + $WindowStates = @{ + 'FORCEMINIMIZE' = 11 + 'HIDE' = 0 + 'MAXIMIZE' = 3 + 'MINIMIZE' = 6 + 'RESTORE' = 9 + 'SHOW' = 5 + 'SHOWDEFAULT' = 10 + 'SHOWMAXIMIZED' = 3 + 'SHOWMINIMIZED' = 2 + 'SHOWMINNOACTIVE' = 7 + 'SHOWNA' = 8 + 'SHOWNOACTIVATE' = 4 + 'SHOWNORMAL' = 1 + } + + $Win32ShowWindowAsync = Add-Type -MemberDefinition @' +[DllImport("user32.dll")] +public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow); +[DllImport("user32.dll", SetLastError = true)] +public static extern bool SetForegroundWindow(IntPtr hWnd); +'@ -Name "Win32ShowWindowAsync" -Namespace Win32Functions -PassThru + + if (!$global:MainWindowHandles) { + $global:MainWindowHandles = @{ } + } + } + + Process { + foreach ($process in $InputObject) { + $handle = $process.MainWindowHandle + + if ($handle -eq 0 -and $global:MainWindowHandles.ContainsKey($process.Id)) { + $handle = $global:MainWindowHandles[$process.Id] + } + + if ($handle -eq 0) { + if (-not $SuppressErrors) { + Write-Error "Main Window handle is '0'" + } + continue + } + + $global:MainWindowHandles[$process.Id] = $handle + + $Win32ShowWindowAsync::ShowWindowAsync($handle, $WindowStates[$State]) | Out-Null + if ($SetForegroundWindow) { + $Win32ShowWindowAsync::SetForegroundWindow($handle) | Out-Null + } + + Write-Verbose ("Set Window State '{1} on '{0}'" -f $MainWindowHandle, $State) + } + } +} \ No newline at end of file diff --git a/Panther/InstalCustome/SetupAdmin.ps1 b/Panther/InstalCustome/SetupAdmin.ps1 new file mode 100644 index 0000000..a11ff5e --- /dev/null +++ b/Panther/InstalCustome/SetupAdmin.ps1 @@ -0,0 +1,81 @@ +# Choix Geo # +$xmlCode =[xml](Get-Content -Path C:\Windows\Panther\unattend.xml -Force) +$Code = $xmlCode.unattend.settings.component.FirstLogonCommands.SynchronousCommand[2].CommandLine +if($? -eq $false){$? +$Code = '4269'} + +# Install Module # +Install-PackageProvider -Name NuGet -Confirm:$false -Force +if( $? -eq $false){$?} +Install-Module -Name AudioDeviceCmdlets -Confirm:$false -Force +if( $? -eq $false){$?} +Import-Module C:\Windows\Panther\InstalCustome\Set-WindowState.ps1 -Force +if( $? -eq $false){$?} + +# Audio 0% # +Set-AudioDevice -PlaybackVolume 0 +if( $? -eq $false){$?} + +# Stop Edge # +ps msedge | Stop-Process -Force +if( $? -eq $false){$?} + +# Copy Hosts # +Copy-Item C:\Windows\Panther\InstalCustome\hosts -Destination C:\Windows\System32\drivers\etc -Force +if( $? -eq $false){$?} + +# Impriment Supprime # +Start-Sleep -Seconds 2 +Remove-Printer -Name "OneNote" +Remove-Printer -Name "Microsoft XPS Document Writer" +if( $? -eq $false){$?} + +# Impriment Crée 4269# +if($code -like '4269'){ +Start-Sleep -Seconds 2 +set-ItemProperty -path "HKCU:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Windows" -name "LegacyDefaultPrinterMode" -Value 1 +pnputil.exe -i -a '\\xxx.xxx.xxx.xx\Nuage\SI_Systeme d information\[INSTALL_2020]\_POUR_INSTALL_POST_WAPT\IMPRIMANTES\VOURLES\MPC3004ex_ETAGE\64bits_MpC3004ex_PCL 6 Driver_z79276L16\disk1\oemsetup.inf' +Add-PrinterDriver -Name "RICOH MP C3004 PCL 6" +Add-PrinterPort -Name "xxx.xxx.xxx.xx" -PrinterHostAddress "xxx.xxx.xxx.xx" +Add-Printer -DriverName "RICOH MP C3004 PCL 6" -PortName "xxx.xxx.xxx.xx" -Name "RICOH MP C3004 PCL 6 (Vourles Etage)" +$MYPRINTER = "RICOH MP C3001 PCL 6 (Vourles Etage)" +$PRINTERTMP = (Get-CimInstance -ClassName CIM_Printer | WHERE {$_.Name -eq $MYPRINTER}[0]) +$PRINTERTMP | Invoke-CimMethod -MethodName SetDefaultPrinter | Out-Null +if( $? -eq $false){$?}} + + +# Play Fox # +Start-Process -FilePath "C:\Windows\Panther\InstalCustome\Firefox Installer.exe" "/verysilent" +Do{ +Start-Sleep -Seconds 5 +$fox = Get-Process -Name 'Firefox Installer' +$fox +Start-Sleep -Seconds 2 +}Until($fox.SI -lt 1) +$loopnum = 0 +Do{ +Start-Process firefox https://www.mozilla.org/fr/firefox/set-as-default/thanks/ +Start-Sleep -Seconds 4 +if($loopnum -ge 5){$loopnum = 0 +break} +$loopnum++ +$ProgIDname = (Get-ItemProperty -Path 'HKCU:\SOFTWARE\Microsoft\Windows\Shell\Associations\UrlAssociations\https\UserChoice' -Name ProgId).ProgID +$ProgIDname +}Until($ProgIDname -like "Firefox*") +Stop-Process -Name firefox +if( $? -eq $false){$?} + +# Alimentation # +powercfg /l +powercfg /setdcvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0 +powercfg /setacvalueindex 381b4222-f694-41f0-9685-ff5bb260df2e 4f971e89-eebd-4455-a8de-9e59040e7347 5ca83367-6e45-459f-a27b-476b1d01c936 0 +if( $? -eq $false){$?} + +# ShadowStorage # +Enable-ComputerRestore -Drive c: +vssadmin Resize ShadowStorage /For=C: /On=C: /Maxsize=10% +vssadmin list shadowstorage# +if( $? -eq $false){$?} + +# Registre Meteo # +reg import C:\Windows\Panther\InstalCustome\Feeds.reg diff --git a/Panther/InstalCustome/SetupPChosts.bat b/Panther/InstalCustome/SetupPChosts.bat new file mode 100644 index 0000000..486af7f --- /dev/null +++ b/Panther/InstalCustome/SetupPChosts.bat @@ -0,0 +1,17 @@ +@echo off + +powershell Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope CurrentUser -Force + +powershell -ExecutionPolicy Bypass -File "C:\Windows\Panther\InstalCustome\Execute.ps1" "/verysilent" + +powershell -ExecutionPolicy Bypass "Start-process powershell -Verb runAs C:\Windows\Panther\InstalCustome\SetupAdmin.ps1" + +powershell Start-Sleep -Seconds 180 + +powershell -ExecutionPolicy Bypass -File "C:\Windows\Panther\InstalCustome\BiosManufacturer.ps1" "/verysilent" + +powershell -ExecutionPolicy Bypass -File "C:\Windows\Panther\InstalCustome\Lecteur.ps1" "/verysilent" + +powershell -ExecutionPolicy Bypass -File "C:\Windows\Panther\InstalCustome\TrueInstallApp.ps1" "/verysilent" + +Pause diff --git a/Panther/InstalCustome/SoftwareLicensingService.bat b/Panther/InstalCustome/SoftwareLicensingService.bat new file mode 100644 index 0000000..6565f36 --- /dev/null +++ b/Panther/InstalCustome/SoftwareLicensingService.bat @@ -0,0 +1,8 @@ +@echo off +echo Copie de la Cle Windows... +powershell -ExecutionPolicy Bypass "(Set-Clipboard -Value (Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey)" +powershell -ExecutionPolicy Bypass "((Get-WmiObject -query 'select * from SoftwareLicensingService').OA3xOriginalProductKey)" +powershell "Start-Sleep -Seconds 1 +echo Cle Windows Copier avec Succes +powershell "Start-Sleep -Seconds 5" +exit \ No newline at end of file