# Self-elevate the script if required if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) { if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) { $Command = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments Start-Process -FilePath PowerShell.exe -Verb RunAs -ArgumentList $Command Exit } } # Place your script here $Host.UI.RawUI.WindowTitle = "AccessCreed Installer v3" $Host.UI.RawUI.BackgroundColor = ($bckgrnd = 'Black') $Host.UI.RawUI.ForegroundColor = 'red' $host.PrivateData.ProgressForegroundColor = "magenta" $host.PrivateData.ProgressBackgroundColor = "black" Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force Install-Module -Name WriteAscii -Force $keypath = Split-path -parent $MyInvocation.MyCommand.Definition Function AccessCreed { Clear-Host Write-Ascii AccessCreed -fore red -back black $DesktopPath = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::Desktop) $ProfilePath = $env:userprofile $OfficeInstallDownloadPath = "C:\Scripts\Office365Install" $ConfiguratonXMLFile = "D:\Win10apiAccessCreed\Configuration.xml" # PromptForChoice Args $Title = "Quelle conf désirez-vous que je réalise mon Seigneur ?" $Prompt = "Exigez, j'exécute !" $Choices = [System.Management.Automation.Host.ChoiceDescription[]] @("&Fifty-Bees", "&Standard", "&Install-Pkg", "&Clear-Session", "&Quitter") $Default = 1 # Prompt for the choice $Choice = $host.UI.PromptForChoice($Title, $Prompt, $Choices, $Default) # Action based on the choice switch($Choice) { #FIFTY-BEES 0 { Write-Host "Fifty-Bees, c'est parti mon kiki !" Start-Sleep -Seconds 2 # PromptForChoice Args $Title = "Faut-il installer les imprimantes vénérable maître ?" $Prompt = "A votre convenance !" $Choices = [System.Management.Automation.Host.ChoiceDescription[]] @("&Oui", "&Non", "&Annuler") $Default = 0 # Prompt for the choice $Choice = $host.UI.PromptForChoice($Title, $Prompt, $Choices, $Default) # Action based on the choice switch($Choice) { 0 { Write-Host "Installation des imprimantes SGL/Oullins !" Start-Sleep -Seconds 2 Get-PrinterPort | Where name -eq "10.0.8.79" | Remove-PrinterPort Get-PrinterPort | Where name -eq "10.0.8.77" | Remove-PrinterPort Get-PrinterPort | Where name -eq "10.0.8.76" | Remove-PrinterPort Get-PrinterPort | Where name -eq "10.0.8.75" | Remove-PrinterPort Get-PrinterPort | Where name -eq "10.0.10.53" | Remove-PrinterPort Get-PrinterPort | Where name -eq "10.0.10.52" | Remove-PrinterPort Get-PrinterPort | Where name -eq "10.0.10.51" | Remove-PrinterPort $Path ="D:\Win10apiAccessCreed\UNIV_5.860.1.0_PS_x64\UNIV_5.860.1.0_PS_x64_Driver.inf" Get-ChildItem -path $path -Recurse | Where-object -property Extension -EQ ".inf" | ForEach { PNPUtil.exe -a $PSItem.FullName } # Ajout des drivers Add-PrinterDriver -Name "Xerox GPD PS V5.860.1.0" # Ports Oullins Add-PrinterPort -Name "10.0.8.79" -PrinterHostAddress "10.0.8.79" Add-PrinterPort -Name "10.0.8.77" -PrinterHostAddress "10.0.8.77" Add-PrinterPort -Name "10.0.8.76" -PrinterHostAddress "10.0.8.76" Add-PrinterPort -Name "10.0.8.75" -PrinterHostAddress "10.0.8.75" # Ports SGL Add-PrinterPort -Name "10.0.10.53" -PrinterHostAddress "10.0.10.53" Add-PrinterPort -Name "10.0.10.52" -PrinterHostAddress "10.0.10.52" Add-PrinterPort -Name "10.0.10.51" -PrinterHostAddress "10.0.10.51" #Imprimantes Oullins Add-Printer -DriverName "Xerox GPD PS V5.860.1.0" -Name "OULLINS_COPIEUR_3EME" -PortName "10.0.8.79" Add-Printer -DriverName "Xerox GPD PS V5.860.1.0" -Name "OULLINS_COPIEUR_2EME" -PortName "10.0.8.77" Add-Printer -DriverName "Xerox GPD PS V5.860.1.0" -Name "OULLINS_COPIEUR_1ER" -PortName "10.0.8.76" Add-Printer -DriverName "Xerox GPD PS V5.860.1.0" -Name "OULLINS_COPIEUR_RDC_ADMIN" -PortName "10.0.8.75" #Imprimantes SGL Add-Printer -DriverName "Xerox GPD PS V5.860.1.0" -Name "SGL_Accueil" -PortName "10.0.10.53" Add-Printer -DriverName "Xerox GPD PS V5.860.1.0" -Name "SGL_Fourniture" -PortName "10.0.10.52" Add-Printer -DriverName "Xerox GPD PS V5.860.1.0" -Name "SGL_Salle-Info" -PortName "10.0.10.51" Write-Output "Installation des imprimantes SGL/Oullins terminée !" Start-Sleep -Seconds 2 } 1 { Write-Host "Bien reçu mon Seigneur !" Start-Sleep -Seconds 2 } 2 { Write-Host "C'était un plaisir de servir my Lord !" Start-Sleep -Seconds 2 Exit } } Install-PackageProvider chocolatey -Force Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) choco install classic-shell -installArgs ADDLOCAL=ClassicStartMenu -y -r --no-progress choco install citrix-receiver -y -r --no-progress #choco install microsoft-office-deployment --params '/Product:ProPlus2019Volume /Language:fr-fr /Exclude:Access,Lync,OneDrive,OneNote /DisableUpdate:TRUE' -y #Office Deployment Tool Setup Try{ Write-Verbose "Office Deployment Tool..." Start-Process "D:\Win10apiAccessCreed\WODTSetup.exe" -ArgumentList "/quiet /extract:$OfficeInstallDownloadPath" -Wait }Catch{ Write-Warning "Erreur suivante sur ODT :" Write-Warning $_ } #Office 19 Pro Setup Try{ Write-Verbose "Installation d'Office 2019 Pro Plus 32bit" $OfficeInstall = Start-Process "$OfficeInstallDownloadPath\Setup.exe" -ArgumentList "/configure $ConfiguratonXMLFile" -Wait -PassThru }Catch{ Write-Warning "Erreur suivante pendant l'install :" Write-Warning $_ } Copy-Item "D:\Win10apiAccessCreed\KMSAutoS" -Destination "C:\ProgramData\" -Recurse -Force Copy-Item "D:\Win10apiAccessCreed\OInstall.exe" -Destination "C:\Windows\" -Force $ConvActiv ="D:\Win10apiAccessCreed\OInstall.exe" #$ConvActivArgs = "/proplus x86 fr-fr /convert /activate /y" Start-Process $ConvActiv $ConvActivArgs Start-sleep -Seconds 8 $myshell = New-Object -com "Wscript.Shell" $myshell.sendkeys("{ENTER}") Copy-Item "D:\Win10apiAccessCreed\OInstall.rar" -Destination "C:\" -Force Copy-Item "D:\Win10apiAccessCreed\KMSAuto Net.rar" -Destination "C:\" -Force Set-Volume -DriveLetter C -NewFileSystemLabel "SSD" Register-ScheduledTask -xml (Get-Content 'D:\Win10apiAccessCreed\OInstall.xml' | Out-String) -TaskName "OInstall" -Force Register-ScheduledTask -Xml (Get-Content 'D:\Win10apiAccessCreed\KMSAutoNet.xml' | out-string) -TaskName "KMSAutoNet" -Force choco install microsoft-teams -y -r --no-progress choco install displaylink -y -r --no-progress choco install jabra-direct -y -r --no-progress choco install vlc -y -r --no-progress choco install Firefox -y -r --no-progress Add-Type -AssemblyName System.IO.Compression.FileSystem function Unzip { param([string]$zipfile, [string]$outpath) [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) } function isInstalled { param([string]$programName) $checkInstalled = ((Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*).DisplayName -Match $programName).Length -gt 0 return $checkInstalled } function installFirefoxWithAddIn() { $workdir = $env:TEMP + '\Firefox' $instdir = "C:\Program Files\Mozilla Firefox" $distribution = $instdir + '\distribution' $extensions = $instdir + '\distribution\extensions' $setupEXE = $workdir + '\firefox_setup.exe' $sourceProgram = "https://download.mozilla.org/?product=firefox-latest&os=win64&lang=fr" $sourceAddIn = "https://addons.mozilla.org/firefox/downloads/file/4067141/adblock_plus-3.16.1.xpi" #$addIn_uid = '{42b1ba65-a7d2-4bf3-a481-3b8e5b78bc04}' $addIn_uid = '{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}' $path2XPI = $extensions + '\' + $addIn_uid + '.xpi' #in Mozilla folder. Delete if old extension is there #if(-Not(isInstalled("Mozilla Firefox"))){ #Create temp. directory # If(-Not(Test-Path $workdir)){ # New-Item $workdir -ItemType Container | Out-Null # } #Download Firefox Setup # Invoke-WebRequest $sourceProgram -OutFile $setupEXE #Silent install as admin # Start-Process -FilePath $setupEXE -ArgumentList "/S" -Verb RunAs # Start-Sleep -s 35 #CleanUp # Remove-Item -Force $workdir -Recurse # Write-Host "Installation routine of Firefox completed"; # } else { # Write-Host "Firefox already installed"; # } #Download XPI file of AddIn If(-Not(Test-Path $distribution)){ New-Item $distribution -ItemType Container | Out-Null } If(-Not(Test-Path $extensions)){ New-Item $extensions -ItemType Container | Out-Null } if(-Not(Test-Path $path2XPI)){ Invoke-WebRequest $sourceAddIn -Outfile $path2XPI Write-Host "AddIn " $addIn_uid " created"; } else { Write-Host "Source file for extension already exists"; } } installFirefoxWithAddIn(""); choco install GoogleChrome -y -r --no-progress #Install Chrome Adblock Plus New-Item -path 'HKLM:\SOFTWARE\Policies\' -Name 'Google' -Force -ErrorAction SilentlyContinue | out-null New-Item -path 'HKLM:\SOFTWARE\Policies\Google\' -Name 'Chrome' -Force -ErrorAction SilentlyContinue | out-null New-Item -path 'HKLM:\SOFTWARE\Policies\Google\Chrome\' -Name 'ExtensionInstallForcelist' -Force -ErrorAction SilentlyContinue | out-null New-ItemProperty –Path 'HKLM:\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist' -Name 1 -PropertyType String -Value cfhdojbkjhnklbpkdaibdccddilifddb -Force -ErrorAction SilentlyContinue | out-null choco install winrar -y -r --no-progress Copy-Item "D:\Win10apiAccessCreed\rarreg.key" -Destination "C:\Program Files\WinRAR" -Force If ((Get-ScheduledTask -TaskName 'ScheduledDefrag').State -eq 'Ready') { Disable-ScheduledTask -TaskName 'ScheduledDefrag' -TaskPath '\Microsoft\Windows\Defrag' } Get-ScheduledTask -TaskName 'ScheduledDefrag' Start-Sleep -Seconds 2 Copy-Item "D:\Win10apiAccessCreed\FB-Connect.exe" -Destination $DesktopPath Copy-Item "D:\Win10apiAccessCreed\backgroundFB.jpg" -Destination "$ProfilePath\background.jpg" Copy-Item "D:\Win10apiAccessCreed\cegid.ico" -Destination $ProfilePath Copy-Item "D:\Win10apiAccessCreed\lexis.ico" -Destination $ProfilePath Copy-Item "D:\Win10apiAccessCreed\logo_rca.ico" -Destination $ProfilePath #lnk cegid $wshShell = New-Object -ComObject "WScript.Shell" $urlShortcut = $wshShell.CreateShortcut( (Join-Path $wshShell.SpecialFolders.Item("Desktop") "Cegid-Expert.lnk") ) $urlShortcut.TargetPath = "https://expert-ondemand.cegid.com/" $urlShortcut.IconLocation = "$ProfilePath\cegid.ico" $urlShortcut.Save() #lnk rca $wshShell = New-Object -ComObject "WScript.Shell" $urlShortcut = $wshShell.CreateShortcut( (Join-Path $wshShell.SpecialFolders.Item("Desktop") "RCA.lnk") ) $urlShortcut.TargetPath = "https://rcaondemand.coaxis.com/" $urlShortcut.IconLocation = "$ProfilePath\logo_rca.ico" $urlShortcut.Save() #lnk lexis $wshShell = New-Object -ComObject "WScript.Shell" $urlShortcut = $wshShell.CreateShortcut( (Join-Path $wshShell.SpecialFolders.Item("Desktop") "Lexis Polyacte Saas.lnk") ) $urlShortcut.TargetPath = "https://authcore-lexispoly.lexispolyacte.fr/login" $urlShortcut.IconLocation = "$ProfilePath\lexis.ico" $urlShortcut.Save() #Autres installs & 'D:\Win10apiAccessCreed\#Manuel\ASU__ASUS_DisplayWidget_3.1.0.014.exe' & 'D:\Win10apiAccessCreed\#Manuel\Adobe-Acrobat-Pro-DC-v2019.021.20049-Pre-Activated\Setup.exe' & 'D:\Win10apiAccessCreed\#Manuel\Avaya-Equinox-Setup-3.6.4.31.2.msi' & 'D:\Win10apiAccessCreed\#Manuel\akuiteo.setup-v4.0_20180705.exe' Start-ScheduledTask -TaskName "KMSAutoNet" Copy-Item "D:\Win10apiAccessCreed\Metro - Black Pearl.skin7" -Destination "C:\Program Files\Classic Shell\Skins\" #reg import "D:\Win10apiAccessCreed\classicshell.reg" & 'C:\Program Files\Classic Shell\ClassicStartMenu.exe' -xml 'D:\Win10apiAccessCreed/ClassicSettings.xml' & 'C:\Program Files\Mozilla Firefox\firefox.exe' & 'C:\Program Files\Google\Chrome\Application\chrome.exe' $MyWallpaper="$ProfilePath\background.jpg" $code = @' using System.Runtime.InteropServices; namespace Win32{ public class Wallpaper{ [DllImport("user32.dll", CharSet=CharSet.Auto)] static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ; public static void SetWallpaper(string thePath){ SystemParametersInfo(20,0,thePath,3); } } } '@ add-type $code [Win32.Wallpaper]::SetWallpaper($MyWallpaper) Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' HideFileExt 0 -Force | Out-Null Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' LaunchTo 1 -Force | Out-Null Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer' ShowFrequent 0 -Force | Out-Null Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer' ShowRecent 0 -Force | Out-Null New-Item -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\' -Name 'ClassicStartMenu' -Force | Out-Null New-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{20D04FE0-3AEA-1069-A2D8-08002B30309D}' -PropertyType 'Dword' -Value 0 -Force | Out-Null New-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{20D04FE0-3AEA-1069-A2D8-08002B30309D}' -PropertyType 'Dword' -Value 0 -Force | Out-Null New-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{59031a47-3f72-44a7-89c5-5595fe6b30ee}' -PropertyType 'Dword' -Value 0 -Force | Out-Null New-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{59031a47-3f72-44a7-89c5-5595fe6b30ee}' -PropertyType 'Dword' -Value 0 -Force | Out-Null New-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'TaskbarGlomLevel' -PropertyType 'Dword' -Value 2 -Force | Out-Null Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search' SearchboxTaskbarMode 0 -Force | Out-Null Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' ShowCortanaButton 0 -Force | Out-Null Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Feeds' ShellFeedsTaskbarViewMode 2 -Force | Out-Null Stop-Process -processname explorer Set-MpPreference -DisableRealtimeMonitoring $false $logsuccess = Get-Content 'C:\ProgramData\chocolatey\logs\choco.summary.log' | Select-String 'was successful' -CaseSensitive $logsuccess = $logsuccess -replace '\d+','' -replace '-|:|,','' -replace '\.','`n' $logfail = Get-Content 'C:\ProgramData\chocolatey\logs\choco.summary.log' | Select-String 'was NOT successful.' -CaseSensitive $logfail = $logfail -replace '\d+','' -replace '-|:|,','' -replace '\.','`n' Start-Process powershell @" -NoProfile -Command " Write-Host Installations réussies Write-Host \"$logsuccess\" -ForegroundColor Green -BackgroundColor Black Write-Host Installations loupées Write-Host \"$logfail\" -ForegroundColor Red -BackgroundColor Black pause " "@ Set-ExecutionPolicy Remotesigned Install-Module PSWindowsUpdate -Force Get-WindowsUpdate -AcceptAll -Install -AutoReboot } # STANDARD 1 { Write-Host "Standard, banzaïïïï my Lord !" Start-Sleep -Seconds 2 Set-MpPreference -DisableRealtimeMonitoring $true Add-MpPreference -ExclusionPath "C:\ProgramData\KMSAutoS" Add-MpPreference -ExclusionPath "'C:\ProgramData\KMSAutoS\KMSAuto Net.exe'" Add-MpPreference -ExclusionPath "C:\ProgramData\KMSAutoS\kmsauto.ini" Add-MpPreference -ExclusionPath "C:\Windows\System32\Tasks\KMSAutoNet" Add-MpPreference -ExclusionPath "C:\Windows\System32\Tasks\OInstall" Add-MpPreference -ExclusionPath "C:\Windows\OInstall.exe" Add-MpPreference -ExclusionPath "C:\ProgramData\KMSAutoS\bin" Add-MpPreference -ExclusionPath "C:\ProgramData\KMSAutoS\bin\KMSSS.exe" Add-MpPreference -ExclusionPath "C:\ProgramData\KMSAutoS\bin\TunMirror.exe" Add-MpPreference -ExclusionPath "C:\ProgramData\KMSAutoS\bin\TunMirror2.exe" Add-MpPreference -ExclusionPath "%localappdata%\Temp\KMSAuto\SppExtComObjHook.dll" Add-MpPreference -ExclusionPath "%localappdata%\Temp\KMSAuto\SppExtComObjPatcher.exe" Install-PackageProvider chocolatey -Force Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) choco install classic-shell -installArgs ADDLOCAL=ClassicStartMenu -y -r --no-progress #choco install microsoft-office-deployment --params '/Product:ProPlus2019Volume /Language:fr-fr /Exclude:Access,Lync,OneDrive,OneNote /DisableUpdate:TRUE' -y #Office Deployment Tool Setup Try{ Write-Verbose "Office Deployment Tool..." Start-Process "D:\Win10apiAccessCreed\WODTSetup.exe" -ArgumentList "/quiet /extract:$OfficeInstallDownloadPath" -Wait }Catch{ Write-Warning "Erreur suivante sur ODT :" Write-Warning $_ } #Office 19 Pro Setup Try{ Write-Verbose "Installation d'Office 2019 Pro Plus 32bit" $OfficeInstall = Start-Process "$OfficeInstallDownloadPath\Setup.exe" -ArgumentList "/configure $ConfiguratonXMLFile" -Wait -PassThru }Catch{ Write-Warning "Erreur suivante pendant l'install :" Write-Warning $_ } Copy-Item "D:\Win10apiAccessCreed\KMSAutoS" -Destination "C:\ProgramData\" -Recurse -Force Copy-Item "D:\Win10apiAccessCreed\OInstall.exe" -Destination "C:\Windows\" -Force $ConvActiv ="D:\Win10apiAccessCreed\OInstall.exe" #$ConvActivArgs = "/proplus x86 fr-fr /convert /activate" Start-Process $ConvActiv $ConvActivArgs Start-sleep -Seconds 8 $myshell = New-Object -com "Wscript.Shell" $myshell.sendkeys("{ENTER}") Copy-Item "D:\Win10apiAccessCreed\OInstall.rar" -Destination "C:\" -Force Copy-Item "D:\Win10apiAccessCreed\KMSAuto Net.rar" -Destination "C:\" -Force Set-Volume -DriveLetter C -NewFileSystemLabel "SSD" Register-ScheduledTask -xml (Get-Content 'D:\Win10apiAccessCreed\OInstall.xml' | Out-String) -TaskName "OInstall" -Force Register-ScheduledTask -Xml (Get-Content 'D:\Win10apiAccessCreed\KMSAutoNet.xml' | out-string) -TaskName "KMSAutoNet" -Force choco install microsoft-teams -y -r --no-progress choco install vlc -y -r --no-progress choco install Firefox -y -r --no-progress Add-Type -AssemblyName System.IO.Compression.FileSystem function Unzip { param([string]$zipfile, [string]$outpath) [System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) } function isInstalled { param([string]$programName) $checkInstalled = ((Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*).DisplayName -Match $programName).Length -gt 0 return $checkInstalled } function installFirefoxWithAddIn() { $workdir = $env:TEMP + '\Firefox' $instdir = "C:\Program Files\Mozilla Firefox" $distribution = $instdir + '\distribution' $extensions = $instdir + '\distribution\extensions' $setupEXE = $workdir + '\firefox_setup.exe' $sourceProgram = "https://download.mozilla.org/?product=firefox-latest&os=win64&lang=fr" $sourceAddIn = "https://addons.mozilla.org/firefox/downloads/file/4067141/adblock_plus-3.16.1.xpi" #$addIn_uid = '{42b1ba65-a7d2-4bf3-a481-3b8e5b78bc04}' $addIn_uid = '{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}' $path2XPI = $extensions + '\' + $addIn_uid + '.xpi' #in Mozilla folder. Delete if old extension is there #if(-Not(isInstalled("Mozilla Firefox"))){ #Create temp. directory # If(-Not(Test-Path $workdir)){ # New-Item $workdir -ItemType Container | Out-Null # } #Download Firefox Setup # Invoke-WebRequest $sourceProgram -OutFile $setupEXE #Silent install as admin # Start-Process -FilePath $setupEXE -ArgumentList "/S" -Verb RunAs # Start-Sleep -s 35 #CleanUp # Remove-Item -Force $workdir -Recurse # Write-Host "Installation routine of Firefox completed"; # } else { # Write-Host "Firefox already installed"; # } #Download XPI file of AddIn If(-Not(Test-Path $distribution)){ New-Item $distribution -ItemType Container | Out-Null } If(-Not(Test-Path $extensions)){ New-Item $extensions -ItemType Container | Out-Null } if(-Not(Test-Path $path2XPI)){ Invoke-WebRequest $sourceAddIn -Outfile $path2XPI Write-Host "AddIn " $addIn_uid " created"; } else { Write-Host "Source file for extension already exists"; } } installFirefoxWithAddIn(""); choco install GoogleChrome -y -r --no-progress #Install Chrome Adblock Plus New-Item -path 'HKLM:\SOFTWARE\Policies\' -Name 'Google' -Force -ErrorAction SilentlyContinue | out-null New-Item -path 'HKLM:\SOFTWARE\Policies\Google\' -Name 'Chrome' -Force -ErrorAction SilentlyContinue | out-null New-Item -path 'HKLM:\SOFTWARE\Policies\Google\Chrome\' -Name 'ExtensionInstallForcelist' -Force -ErrorAction SilentlyContinue | out-null New-ItemProperty –Path 'HKLM:\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist' -Name 1 -PropertyType String -Value cfhdojbkjhnklbpkdaibdccddilifddb -Force -ErrorAction SilentlyContinue | out-null choco install winrar -y -r --no-progress Copy-Item "D:\Win10apiAccessCreed\rarreg.key" -Destination "C:\Program Files\WinRAR" -Force If ((Get-ScheduledTask -TaskName 'ScheduledDefrag').State -eq 'Ready') { Disable-ScheduledTask -TaskName 'ScheduledDefrag' -TaskPath '\Microsoft\Windows\Defrag' } Get-ScheduledTask -TaskName 'ScheduledDefrag' Start-Sleep -Seconds 2 Copy-Item "D:\Win10apiAccessCreed\backgroundAC.jpg" -Destination "$ProfilePath\background.jpg" & 'D:\Win10apiAccessCreed\#Manuel\Adobe-Acrobat-Pro-DC-v2019.021.20049-Pre-Activated\Setup.exe' Invoke-Command -ScriptBlock $pathvargs Start-ScheduledTask -TaskName "KMSAutoNet" Copy-Item "D:\Win10apiAccessCreed\Metro - Black Pearl.skin7" -Destination "C:\Program Files\Classic Shell\Skins\" #reg import "D:\Win10apiAccessCreed\classicshell.reg" & 'C:\Program Files\Classic Shell\ClassicStartMenu.exe' -xml 'D:\Win10apiAccessCreed/ClassicSettings.xml' & 'C:\Program Files\Mozilla Firefox\firefox.exe' & 'C:\Program Files\Google\Chrome\Application\chrome.exe' $MyWallpaper="$ProfilePath\background.jpg" $code = @' using System.Runtime.InteropServices; namespace Win32{ public class Wallpaper{ [DllImport("user32.dll", CharSet=CharSet.Auto)] static extern int SystemParametersInfo (int uAction , int uParam , string lpvParam , int fuWinIni) ; public static void SetWallpaper(string thePath){ SystemParametersInfo(20,0,thePath,3); } } } '@ add-type $code [Win32.Wallpaper]::SetWallpaper($MyWallpaper) Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' HideFileExt 0 -Force | Out-Null Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' LaunchTo 1 -Force | Out-Null Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer' ShowFrequent 0 -Force | Out-Null Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer' ShowRecent 0 -Force | Out-Null New-Item -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\' -Name 'ClassicStartMenu' -Force | Out-Null New-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{20D04FE0-3AEA-1069-A2D8-08002B30309D}' -PropertyType 'Dword' -Value 0 -Force | Out-Null New-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{20D04FE0-3AEA-1069-A2D8-08002B30309D}' -PropertyType 'Dword' -Value 0 -Force | Out-Null New-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel' -Name '{59031a47-3f72-44a7-89c5-5595fe6b30ee}' -PropertyType 'Dword' -Value 0 -Force | Out-Null New-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\ClassicStartMenu' -Name '{59031a47-3f72-44a7-89c5-5595fe6b30ee}' -PropertyType 'Dword' -Value 0 -Force | Out-Null New-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'TaskbarGlomLevel' -PropertyType 'Dword' -Value 2 -Force | Out-Null Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search' SearchboxTaskbarMode 0 -Force | Out-Null Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' ShowCortanaButton 0 -Force | Out-Null Set-ItemProperty 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Feeds' ShellFeedsTaskbarViewMode 2 -Force | Out-Null Stop-Process -processname explorer Set-MpPreference -DisableRealtimeMonitoring $false $logsuccess = Get-Content 'C:\ProgramData\chocolatey\logs\choco.summary.log' | Select-String 'was successful' -CaseSensitive $logsuccess = $logsuccess -replace '\d+','' -replace '-|:|,','' -replace '\.','`n' $logfail = Get-Content 'C:\ProgramData\chocolatey\logs\choco.summary.log' | Select-String 'was NOT successful.' -CaseSensitive $logfail = $logfail -replace '\d+','' -replace '-|:|,','' -replace '\.','`n' Start-Process powershell @" -NoProfile -Command " Write-Host Installations réussies Write-Host \"$logsuccess\" -ForegroundColor Green -BackgroundColor Black Write-Host Installations loupées Write-Host \"$logfail\" -ForegroundColor Red -BackgroundColor Black pause " "@ Set-ExecutionPolicy Remotesigned Install-Module PSWindowsUpdate -Force Get-WindowsUpdate -AcceptAll -Install -AutoReboot } # Choix indiv pkg 2 { # PromptForChoice Args $Title = "Que désirez-vous installer sa Sainteté ?" $Prompt = "Ordonnez-moi !" $Choices = [System.Management.Automation.Host.ChoiceDescription[]] @("&Office-19Pro", "&Env-Session", "&Env-Soft", "&Retour") $Default = 1 # Prompt for the choice $Choice = $host.UI.PromptForChoice($Title, $Prompt, $Choices, $Default) # Action based on the choice switch($Choice) { #OFFICE 2019 PRO 0 { #Office Deployment Tool Setup Try{ Write-Verbose "Office Deployment Tool..." Start-Process "D:\Win10apiAccessCreed\WODTSetup.exe" -ArgumentList "/quiet /extract:$OfficeInstallDownloadPath" -Wait }Catch{ Write-Warning "Erreur suivante sur ODT :" Write-Warning $_ } #Office 19 Pro Setup Try{ Write-Verbose "Installation d'Office 2019 Pro Plus 32bit" $OfficeInstall = Start-Process "$OfficeInstallDownloadPath\Setup.exe" -ArgumentList "/configure $ConfiguratonXMLFile" -Wait -PassThru }Catch{ Write-Warning "Erreur suivante pendant l'install :" Write-Warning $_ } Copy-Item "D:\Win10apiAccessCreed\OInstall.exe" -Destination "C:\Windows\" -Force $ConvActiv ="D:\Win10apiAccessCreed\OInstall.exe" #$ConvActivArgs = "/proplus x86 fr-fr /convert /activate /y" Start-Process $ConvActiv $ConvActivArgs Start-sleep -Seconds 8 $myshell = New-Object -com "Wscript.Shell" $myshell.sendkeys("{ENTER}") Copy-Item "D:\Win10apiAccessCreed\OInstall.rar" -Destination "C:\" -Force } #ENV SESSION 1 { Set-MpPreference -DisableRealtimeMonitoring $true Add-MpPreference -ExclusionPath "C:\ProgramData\KMSAutoS" Add-MpPreference -ExclusionPath "'C:\ProgramData\KMSAutoS\KMSAuto Net.exe'" Add-MpPreference -ExclusionPath "C:\ProgramData\KMSAutoS\kmsauto.ini" Add-MpPreference -ExclusionPath "C:\Windows\System32\Tasks\KMSAutoNet" Add-MpPreference -ExclusionPath "C:\Windows\System32\Tasks\OInstall" Add-MpPreference -ExclusionPath "C:\Windows\OInstall.exe" Add-MpPreference -ExclusionPath "C:\ProgramData\KMSAutoS\bin" Add-MpPreference -ExclusionPath "C:\ProgramData\KMSAutoS\bin\KMSSS.exe" Add-MpPreference -ExclusionPath "C:\ProgramData\KMSAutoS\bin\TunMirror.exe" Add-MpPreference -ExclusionPath "C:\ProgramData\KMSAutoS\bin\TunMirror2.exe" Add-MpPreference -ExclusionPath "%localappdata%\Temp\KMSAuto\SppExtComObjHook.dll" Add-MpPreference -ExclusionPath "%localappdata%\Temp\KMSAuto\SppExtComObjPatcher.exe" Install-PackageProvider chocolatey -Force Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) if (test-path 'C:\Program Files\Classic Shell\ClassicStartMenu.exe') { #true AccessCreed } else { choco install classic-shell -installArgs ADDLOCAL=ClassicStartMenu -y -r --no-progress } } #ENV SOFT 2 { } #RETOUR 3 { AccessCreed } } } # CLEAR-SESSION 3 { #Variables env $userprofile = $env:USERPROFILE $tempfolder = $env:temp $localappdata = $env:LOCALAPPDATA $chromeprofile = $localappdata+"\Google\Chrome\User Data\Default" $microsoftaccount = $localappdata+"\Packages" #Vide corbeille Clear-RecycleBin -Force Write-Host "Corbeille vidée ---> OK" #Défonce profil Get-ChildItem -Path $env:USERPROFILE"\Downloads" *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue Get-ChildItem -Path $env:USERPROFILE"\Documents" *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue Get-ChildItem -Path $env:USERPROFILE"\Music" *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue Get-ChildItem -Path $env:USERPROFILE"\Pictures" *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue Get-ChildItem -Path $env:USERPROFILE"\Videos" *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue Get-ChildItem -Path $env:USERPROFILE"\Desktop" *.* -Exclude *.lnk, *.exe, *.url | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue Write-Host "Corbeille vidée ---> OK" #Défonce %windir%\temp Get-ChildItem -Path "C:\Windows\Temp" *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue Write-Host "Temps windaube vidés ---> OK" #Défonce %temp% Get-ChildItem -Path $tempfolder *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue Write-Host "Temps profil vidés ---> OK" #Défonce résidus d'updates Get-ChildItem -Path "C:\Windows\SoftwareDistribution\Download" *.* -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue Write-Host "Win updates vidées ---> OK" #Défonce profil chrome Get-ChildItem -Path $chromeprofile *.* -Exclude "Extension Rules, Extension Scripts, Extension State, Extensions" -Recurse | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue Write-Host "Chrome vidé ---> OK" Start-Process Chrome.exe -WindowStyle Minimized Start-Sleep -Seconds 3 Stop-Process -Name Chrome #Install Chrome Adblock Plus New-Item -path 'HKLM:\SOFTWARE\Policies\' -Name 'Google' -Force -ErrorAction SilentlyContinue | out-null New-Item -path 'HKLM:\SOFTWARE\Policies\Google\' -Name 'Chrome' -Force -ErrorAction SilentlyContinue | out-null New-Item -path 'HKLM:\SOFTWARE\Policies\Google\Chrome\' -Name 'ExtensionInstallForcelist' -Force -ErrorAction SilentlyContinue | out-null New-ItemProperty –Path 'HKLM:\SOFTWARE\Policies\Google\Chrome\ExtensionInstallForcelist' -Name 1 -PropertyType String -Value cfhdojbkjhnklbpkdaibdccddilifddb -Force -ErrorAction SilentlyContinue | out-null Write-Host "Adblock Chrome ---> OK" #Défonce comptes Microshiot Get-ItemProperty -Path $microsoftaccount | ForEach-Object { Remove-Item -Path "$_\Microsoft.AAD.BrokerPlugin*" -Recurse -Force -ErrorAction SilentlyContinue | Out-Null } Write-Host "Comptes microshiot dégagés ---> OK" #Défonce comptes Microshiot TOUTES LES SESSIONS #Get-ItemProperty -Path "C:\Users\*\AppData\Local\Packages" | ForEach-Object { #Remove-Item -Path "$_\Microsoft.AAD.BrokerPlugin*" -Recurse -Force | Out-Null #} #Write-Host "Comptes microshiot TOUTES SESSIONS dégagés ---> OK" #Suppression ID Vault net use v: /DELETE | out-null cmdkey /delete cloud.fifty-bees.com | out-null cmdkey /list | ForEach-Object{if($_ -like "*Target:*" -and $_ -like "*microsoft*"){cmdkey /del:($_ -replace " ","" -replace "Target:","")}} Write-Host "Vault nettoyé ---> OK" #Suppression profil Outlook Get-ChildItem $env:LOCALAPPDATA\Microsoft\Outlook\* -Include *.ost, *.nst, *.pst -Exclude *@businessname.com* | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue Set-Location HKCU: $Profiles = Get-ChildItem 'HKCU:\SOFTWARE\Microsoft\Office\16.0\Outlook\Profiles' |foreach { Get-ChildItem $_.Name |foreach { Get-ChildItem -Path $_.Name } } foreach($Profile in $Profiles){ try{ $AccountName = Get-ItemPropertyValue -Path $Profile.Name -Name 'Account Name' -ErrorAction Stop if($AccountName -notlike '*@businessname.com' -and $AccountName -like '*@*'){ 'HKCU:\' + ($Profile.Name.Split('\')[1..7] -join '\') | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue } }catch{ Continue } } Get-ChildItem -Path HKCU:\SOFTWARE\Microsoft\Office\16.0\Common\Identity\Identities -Recurse |Remove-Item -Recurse -Force -ErrorAction SilentlyContinue Get-ChildItem -Path $env:LOCALAPPDATA"\Microsoft\Outlook\RoamCache" *.* -Recurse | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue Write-Host "Profil Outlook vidé ---> OK" Start-Sleep -Seconds 5 Start-Process $env:USERPROFILE"\Desktop\FB-Disconnect.exe" -WindowStyle Minimized Start Outlook AccessCreed } # EXIT 4 { Write-Host "OK force et honneur sa Sainteté !" Start-Sleep -Seconds 2 Exit } } } AccessCreed