diff --git a/Old Script/setupScriptInfo.ps1 b/Old Script/setupScriptInfo.ps1 deleted file mode 100644 index 65847a6..0000000 --- a/Old Script/setupScriptInfo.ps1 +++ /dev/null @@ -1,295 +0,0 @@ -#Download temp files -$tmpPath = Join-Path $env:LOCALAPPDATA "Temp" - -$filesToDownload = @( - @{ - Url = "https://education.lego.com/_/downloads/EV3_Classroom_Windows_1.5.3_Global.msi" - FileName = "EV3_Classroom_Windows_1.5.3_Global.msi" - }, - @{ - Url = "https://cdn.discordapp.com/attachments/704760633379389533/1161288505390026772/simulation.zip" - FileName = "simulation.zip" - }, - @{ - Url = "https://cdn.discordapp.com/attachments/704760633379389533/1161288504765059172/RobotProg.zip" - FileName = "RobotProg.zip" - }, - @{ - Url = "https://officecdn.microsoft.com/db/492350f6-3a01-4f97-b9c0-c7c6ddf67d60/media/fr-fr/O365ProPlusRetail.img" - FileName = "O365ProPlusRetail.img" - } -) - -foreach ($fileInfo in $filesToDownload) { - $filePath = Join-Path $tmpPath $fileInfo.FileName - - if (-not (Test-Path -Path $filePath -PathType Leaf)) { - Invoke-WebRequest -Uri $fileInfo.Url -OutFile $filePath - } -} - -# Install Office -function CheckOfficeInstall { - $officeRegistryPath = "HKLM:\SOFTWARE\Microsoft\Office\ClickToRun" - if (Test-Path -Path $officeRegistryPath) { - $installedPath = Get-ItemProperty -Path $officeRegistryPath | Select-Object -ExpandProperty "InstallPath" - if ($installedPath) { - Write-Host "Microsoft Office is installed at: $installedPath" - - if ($installedPath -like "C:\Program Files*") { - Write-Host "Office is installed as 64-bit." - } elseif ($installedPath -like "C:\Program Files (x86)*") { - Write-Host "Office is installed as 32-bit." - } else { - Write-Host "Office architecture is unknown." - } - } else { - Write-Host "Microsoft Office is installed, but the path could not be determined." - } - } else { - Write-Host "Microsoft Office is not installed." - $mountResult = Mount-DiskImage -ImagePath (Join-Path $tmpPath "O365ProPlusRetail.img") -PassThru - $driveLetter = ($mountResult | Get-Volume).DriveLetter - Start-Process -FilePath $(Join-Path $driveLetter '\Office\Setup64.exe') -Wait - } -} -CheckOfficeInstall - -# Activate windows/office -Invoke-RestMethod https://massgrave.dev/get | Invoke-Expression - -# Setup users -$username = "Eleve" -if ($null -eq $(Get-LocalUser -Name $username -ErrorAction SilentlyContinue)) { - Write-Host "User $username doesn't exist. Creating the user..." - New-LocalUser -Name $username -Description "New User Account" -NoPassword -UserMayNotChangePassword - Add-LocalGroupMember -Group Users -Member $username - Set-LocalUser -Name $username -PasswordNeverExpires $true -UserMayChangePassword $false -Password ([securestring]::new()) -} else { - Write-Host "User $username already exists. Configuring the user..." - Set-LocalUser -Name $username -PasswordNeverExpires $true -UserMayChangePassword $false -} -$username = "Prof" -$SecurePassword = ConvertTo-SecureString -String "IPRprof2398" -AsPlainText -Force -if ($null -eq $(Get-LocalUser -Name $username -ErrorAction SilentlyContinue)) { - Write-Host "User $username doesn't exist. Creating the user..." - New-LocalUser -Name $username -Description "New User Account" -Password $SecurePassword -PasswordNeverExpires -UserMayNotChangePassword - Add-LocalGroupMember -Group Users -Member $username -} else { - Write-Host "User $username already exists. Configuring the user..." - Set-LocalUser -Name $username -PasswordNeverExpires $true -UserMayChangePassword $false -Password $SecurePassword -} -$username = "Admin" -$SecurePassword = ConvertTo-SecureString -String "Lprsnm4ehk26-" -AsPlainText -Force -if ($null -eq $(Get-LocalUser -Name $username -ErrorAction SilentlyContinue)) { - Write-Host "User $username doesn't exist. Creating the user..." - New-LocalUser -Name $username -Description "New User Account" -Password $SecurePassword -PasswordNeverExpires -UserMayNotChangePassword - Add-LocalGroupMember -Group Administrators -Member $username -} else { - Write-Host "User $username already exists. Configuring the user..." - Set-LocalUser -Name $username -PasswordNeverExpires $true -Password $SecurePassword -} - - -# Function to load a user's HKU registry hive -function UserReg { - param ( - [string] $Username - ) - $UserProfiles = Get-WmiObject Win32_UserProfile | Where-Object { $_.Special -eq $false } - $UserProfile = $UserProfiles | Where-Object { $_.LocalPath.EndsWith("\$Username") } - if ($null -ne $UserProfile) { - $UserSID = $UserProfile.SID - if( -not (Test-Path -Path "Registry::HKEY_USERS\$UserSID" -PathType Container) ) { - REG LOAD HKEY_USERS\$UserSID "C:\Users\$Username\NTUSER.DAT" - } - return $UserSID, "Registry::HKEY_USERS\$UserSID" - } else { - Write-Host "User profile for $Username not found." - return $null, $null - } -} - -function SetRegistry { - param ( - [string] $regpath, - [string] $regproperty - ) - - if( -not (Test-Path -Path $regpath -PathType Container) ) { - New-Item -Path $regpath -Force -ItemType Registry - New-ItemProperty -Path $regpath -Name $regproperty -Value 1 -PropertyType DWord - } - else { - $RegistryItem = Get-ItemProperty -Path $regpath - if ($RegistryItem.PSObject.Properties.Name -contains $regproperty) { - Set-ItemProperty -Path $regpath -Name $regproperty -Value 1 - } else { - New-ItemProperty -Path $regpath -Name $regproperty -Value 1 -PropertyType DWord - } - } -} - -$UserSID, $UserHKUPath = UserReg -Username "Eleve" -# Add restriction -if ($null -ne $UserSID -and $null -ne $UserHKUPath) { - # Restrict access to Settings - $ControlPanelKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" - $ControlPanelValueName = "NoControlPanel" - SetRegistry -regpath $ControlPanelKeyPath -regproperty $ControlPanelValueName - - # Disable access to regedit - $REGKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\System" - $REGValueName = "DisableRegistryTools" - SetRegistry -regpath $REGKeyPath -regproperty $REGValueName - - # Restrict access to Command Prompt - $CMDKeyPath = "$UserHKUPath\Software\Policies\Microsoft\Windows\System" - $CMDValueName = "DisableCMD" - SetRegistry -regpath $CMDKeyPath -regproperty $CMDValueName - - # Add entries to DisallowRun for cmd.exe and powershell.exe - $DisallowRunKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" - $DisallowRunValueName = "DisallowRun" - $DisallowRunPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" - if (-not (Test-Path -Path "Registry::$DisallowRunPath" -PathType Container)) { - New-Item -Path $DisallowRunPath -Force - } - Set-ItemProperty -Path $DisallowRunKeyPath -Name $DisallowRunValueName -Value 1 - $applications = @("cmd.exe", "powershell.exe", "powershell_ise.exe") - Get-ItemProperty -Path $DisallowRunPath | ForEach-Object { - Remove-ItemProperty -Path $DisallowRunPath -Name $_.PSObject.Properties.Name -ErrorAction SilentlyContinue - } - foreach ($valueName in $applications) { - New-ItemProperty -Path $DisallowRunPath -Name $valueName -Value $valueName -PropertyType String - } - REG UNLOAD HKEY_USERS\$UserSID -} else { - Write-Host "Unable to get the user's HKU registry." -} - -# RDP -Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Value 0 -Enable-NetFirewallRule -Group "@FirewallAPI.dll,-28752" - -# Install Functions -function InstallMsi { - param ( - [string] $app - ) - Write-Host "Installing $app..." - $msiFilePath = Join-Path -Path $tmpPath -ChildPath $app - Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$msiFilePath`" /qn" -Wait -} - -function InstallExeSetup { - param ( - [string] $app - ) - Write-Host "Installing $app..." - Start-Process -FilePath $(Join-Path $tmpPath $app) -ArgumentList "/allusers /s" -Wait -} - -function InstallExe { - param ( - [string] $app - ) - $appName = [System.IO.Path]::GetFileNameWithoutExtension($app) - Write-Host "Installing $appName..." - $targetPath = Join-Path $env:ProgramFiles $appName - if (-not (Test-Path -Path $targetPath -PathType Container)) { - New-Item -Path $targetPath -ItemType Directory - } - Copy-Item -Path (Join-Path $tmpPath $app) -Destination $targetPath -Force - createShortcut -exe (Join-Path $targetPath $app) -app $appName -} - -function InstallZipSetup { - param ( - [string] $zip, - [string] $exe - ) - $zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip) - Write-Host "Installing $zipName..." - Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $tmpPath -Force - Start-Process -FilePath $(Join-Path -Path $tmpPath -ChildPath (Join-Path -Path $zipName -ChildPath $exe)) -ArgumentList "/allusers /s" -Wait -} - -function InstallZip { - param ( - [string] $zip, - [string] $exe, - [string] $app - ) - $zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip) - Write-Host "Installing $zipName..." - Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $env:ProgramFiles -Force - if (-not $zipName.Equals($app)) { - Move-Item -Path (Join-Path $env:ProgramFiles $zipName) -Destination (Join-Path $env:ProgramFiles $app) - } - createShortcut -exe $(Join-Path -Path $env:ProgramFiles -ChildPath (Join-Path -Path $app -ChildPath $exe)) -app $app -} - -function createShortcut { - param ( - [string] $exe, - [string] $app - ) - $shell = New-Object -ComObject WScript.Shell - $shortcut = $shell.CreateShortcut($(Join-Path $env:PUBLIC "Desktop\$app.lnk")) - $shortcut.TargetPath = $exe - $shortcut.IconLocation = $exe - $shortcut.WorkingDirectory = (Get-Item $exe).DirectoryName - $shortcut.Save() -} - -#Install Choco -Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - -# Installing needed apps -choco upgrade all -y -choco install dotnet -y -choco install vcredist-all -y -choco install firefox -y -choco install 7zip -y -choco install onlyoffice -y -choco install googleearthpro -y -choco install adobereader -y -choco install sublimetext4 -y -choco install vlc -y -choco install audacity -y - -choco install scratch -y --install-arguments="/allusers" -choco install mblock -y -InstallZip -zip "simulation.zip" -exe "simulation.exe" -app "Simulation Domotique" -choco install arduino -y --install-arguments="/allusers" -choco install ganttproject -y -InstallMsi -app "EV3_Classroom_Windows_1.5.3_Global.msi" -InstallZip -zip "RobotProg.zip" -exe "RobotProg.exe" -app "RobotProg" - -# URL shortcut -function New-DesktopShortcut { - param ( - [string] $ShortcutName, - [string] $TargetUrl - ) - - $wshShell = New-Object -ComObject "WScript.Shell" - $shortcutPath = Join-Path $env:PUBLIC "Desktop\$ShortcutName.url" - - $urlShortcut = $wshShell.CreateShortcut($shortcutPath) - $urlShortcut.TargetPath = $TargetUrl - $urlShortcut.Save() -} - -New-DesktopShortcut -ShortcutName "Office 365" -TargetUrl "https://office.com/" -New-DesktopShortcut -ShortcutName "Ecole Direct" -TargetUrl "https://ecoledirecte.com/" -New-DesktopShortcut -ShortcutName "PIX" -TargetUrl "https://pix.fr/" -New-DesktopShortcut -ShortcutName "Framindmap" -TargetUrl "https://framindmap.org/" - - -# Update Windows -Disable-WindowsOptionalFeature -online -NoRestart -FeatureName internet-explorer-optional-amd64 -Install-Module -Name PSWindowsUpdate -Force -Get-WindowsUpdate -ForceInstall -Install-WindowsUpdate -AcceptAll -AutoReboot diff --git a/Old Script/setupScriptLabo.ps1 b/Old Script/setupScriptLabo.ps1 deleted file mode 100644 index 7ccc7fd..0000000 --- a/Old Script/setupScriptLabo.ps1 +++ /dev/null @@ -1,252 +0,0 @@ -# Activate windows -Invoke-RestMethod https://massgrave.dev/get | Invoke-Expression - -#Download temp files -$tmpPath = Join-Path $env:LOCALAPPDATA "Temp" - -$filesToDownload = @( - @{ - Url = "https://winstars.net/files/version3/winstars_installer.exe" - FileName = "winstars_installer.exe" - }, - @{ - Url = "https://cosphilog.fr/tectoglob3d/Tectoglob3D-win32-ia32.zip" - FileName = "Tectoglob3D-win32-ia32.zip" - }, - @{ - Url = "https://web.archive.org/web/20161115042325/http://extranet.saintjosephtoulouse.org/labo/Files/64_sismolog.sfx.exe" - FileName = "Sismolog.exe" - }, - @{ - Url = "http://acces.ens-lyon.fr/acces/logiciels/applications/tectoglob/Tectoglob_11_complet.zip/at_download/file" - FileName = "Tectoglob_11_complet.zip" - }, - @{ - Url = "http://svt.janzac.free.fr/logiciels/respipoisson/respipoisson.exe" - FileName = "Respipoisson.exe" - }, - @{ - Url = "https://regressi.fr/wp-zip/regressi-mpeg-setup.msi" - FileName = "regressi-mpeg-setup.msi" - }, - @{ - Url = "http://labocharlemagne.free.fr/logiciels/regavi.zip" - FileName = "regavi.zip" - }, - @{ - Url = "https://cdn.discordapp.com/attachments/704760633379389533/1163787807723094037/Radiochr_08.exe" - FileName = "Radiochr.exe" - }, - @{ - Url = "http://acces.ens-lyon.fr/acces/thematiques/evolution/logiciels/phylogene/telechargement-eleves/Phylogene-Lycee-2021.zip" - FileName = "Phylogene-Lycee-2021.zip" - }, - @{ - Url = "http://philippe.cosentino.free.fr/productions/paleoterre/paleoterre_el32.zip" - FileName = "paleoterre_el32.zip" - }, - @{ - Url = "http://acces.ens-lyon.fr/logiciels/EduAnat2/Eduanat2%20Setup%202.0.0.exe" - FileName = "Eduanat2_Setup_2.0.0.exe" - }, - @{ - Url = "https://www.pedagogie.ac-nice.fr//svt/productions/flash/couvac/couvac_exe.zip" - FileName = "couvac_exe.zip" - }, - @{ - Url = "https://acdusdownload.s3.amazonaws.com/ACDLabs202311_ChemSketch_FInstall.zip" - FileName = "ACDLabs202311_ChemSketch_FInstall.zip" - } -) - -foreach ($fileInfo in $filesToDownload) { - $filePath = Join-Path $tmpPath $fileInfo.FileName - - if (-not (Test-Path -Path $filePath -PathType Leaf)) { - Invoke-WebRequest -Uri $fileInfo.Url -OutFile $filePath - } -} - -Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) - -# Setup users -Set-LocalUser -Name "Eleve" -PasswordNeverExpires $true -UserMayChangePassword $false -Password ([securestring]::new()) -$SecurePassword = ConvertTo-SecureString -String "IPRprof2398" -AsPlainText -Force -Set-LocalUser -Name "Prof" -PasswordNeverExpires $true -UserMayChangePassword $false -Password $SecurePassword -$SecurePassword = ConvertTo-SecureString -String "Lprsnm4ehk26-" -AsPlainText -Force -Set-LocalUser -Name "Admin" -PasswordNeverExpires $true -Password $SecurePassword - - -# Function to load a user's HKU registry hive -function UserReg { - param ( - [string] $Username - ) - $UserProfiles = Get-WmiObject Win32_UserProfile | Where-Object { $_.Special -eq $false } - $UserProfile = $UserProfiles | Where-Object { $_.LocalPath.EndsWith("\$Username") } - if ($null -ne $UserProfile) { - $UserSID = $UserProfile.SID - return $UserSID, "Registry::HKEY_USERS\$UserSID" - } else { - Write-Host "User profile for $Username not found." - return $null, $null - } -} - -function SetRegistry { - param ( - [string] $regpath, - [string] $regproperty - ) - - if( -not (Test-Path -Path $regpath -PathType Container) ) { - New-Item -Path $regpath -Force -ItemType Registry - New-ItemProperty -Path $regpath -Name $regproperty -Value 1 -PropertyType DWord - } - else { - $RegistryItem = Get-ItemProperty -Path $regpath - if ($RegistryItem.PSObject.Properties.Name -contains $regproperty) { - Set-ItemProperty -Path $regpath -Name $regproperty -Value 1 - } else { - New-ItemProperty -Path $regpath -Name $regproperty -Value 1 -PropertyType DWord - } - } -} - -$TargetUsername = "Eleve" -$UserSID, $UserHKUPath = UserReg -Username $TargetUsername -# Add restriction -if ($null -ne $UserSID -and $null -ne $UserHKUPath) { - # Restrict access to Settings - $ControlPanelKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" - $ControlPanelValueName = "NoControlPanel" - SetRegistry -regpath $ControlPanelKeyPath -regproperty $ControlPanelValueName - - # Disable access to regedit - $REGKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\System" - $REGValueName = "DisableRegistryTools" - SetRegistry -regpath $REGKeyPath -regproperty $REGValueName - - # Restrict access to Command Prompt - $CMDKeyPath = "$UserHKUPath\Software\Policies\Microsoft\Windows\System" - $CMDValueName = "DisableCMD" - SetRegistry -regpath $CMDKeyPath -regproperty $CMDValueName - - # Add entries to DisallowRun for cmd.exe and powershell.exe - $DisallowRunKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" - $DisallowRunValueName = "DisallowRun" - SetRegistry -regpath $DisallowRunKeyPath -regproperty $DisallowRunValueName - Write-Host (Get-ItemProperty -Path "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun") - - $DisallowRunPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" - $applications = @("cmd.exe", "powershell.exe", "powershell_ise.exe") - Get-ItemProperty -Path $DisallowRunPath | ForEach-Object { - Remove-ItemProperty -Path $DisallowRunPath -Name $_.PSObject.Properties.Name -ErrorAction SilentlyContinue - } - foreach ($valueName in $applications) { - New-ItemProperty -Path $DisallowRunPath -Name $valueName -Value $valueName -PropertyType String - } -} else { - Write-Host "Unable to get the user's HKU registry." -} - - -function InstallMsi { - param ( - [string] $app - ) - $msiFilePath = Join-Path -Path $tmpPath -ChildPath $app - Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$msiFilePath`" /qn" -Wait -} - -function InstallExeSetup { - param ( - [string] $app - ) - Start-Process -FilePath $(Join-Path $tmpPath $app) -ArgumentList "/allusers /s" -Wait -} - -function InstallExe { - param ( - [string] $app - ) - $appName = [System.IO.Path]::GetFileNameWithoutExtension($app) - Write-Host "Installing $appName..." - $targetPath = Join-Path $env:ProgramFiles $appName - if (-not (Test-Path -Path $targetPath -PathType Container)) { - New-Item -Path $targetPath -ItemType Directory - } - Copy-Item -Path (Join-Path $tmpPath $app) -Destination $targetPath -Force - createShortcut -exe (Join-Path $targetPath $app) -app $appName -} - -function InstallZipSetup { - param ( - [string] $zip, - [string] $exe - ) - $zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip) - Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $tmpPath -Force - Start-Process -FilePath $(Join-Path $tmpPath $zipName $exe) -ArgumentList "/allusers /s" -Wait -} - -function InstallZip { - param ( - [string] $zip, - [string] $exe, - [string] $app - ) - $zipName = [System.IO.Path]::GetFileNameWithoutExtension($zip) - - Expand-Archive -Path (Join-Path $tmpPath $zip) -DestinationPath $env:ProgramFiles -Force - Move-Item -Path $(Join-Path $env:ProgramFiles $zipName) -Destination $(Join-Path $env:ProgramFiles $app) - createShortcut -exe $(Join-Path $env:ProgramFiles $app $exe) -app $app -} - -function createShortcut { - param ( - [string] $exe, - [string] $app - ) - $shell = New-Object -ComObject WScript.Shell - $shortcut = $shell.CreateShortcut($(Join-Path $env:PUBLIC "Desktop\$app.lnk")) - $shortcut.TargetPath = $exe - $shortcut.IconLocation = $exe - $shortcut.WorkingDirectory = (Get-Item $exe).DirectoryName - $shortcut.Save() -} - -# Installing needed apps -choco upgrade all -y -choco install dotnet -y -choco install vcredist-all -y -choco install firefox -y -choco install 7zip -y -choco install onlyoffice -y -choco install googleearthpro -y -choco install adobereader -y -choco install sublimetext4 -y -choco install vlc -y -choco install audacity -y -choco install avogadro -y -choco install arduino -y --install-arguments="/allusers" --force - -InstallExeSetup -app "winstars_installer.exe" -InstallZip -zip "Tectoglob3D-win32-ia32.zip" -exe "Tectoglob3D.exe" -app "Tectoglob3D" -InstallExe -app "Sismolog.exe" -InstallZip -zip "Tectoglob_11_complet.zip" -exe "TectoGlob.exe" -app "TectoGlob" -InstallExe -app "Respipoisson.exe" -InstallMsi -app "regressi-mpeg-setup.msi" -InstallZip -zip "regavi.zip" -exe "regavi.exe" -app "Regavi" -InstallExe -app "Radiochr.exe" -InstallZip -zip "Phylogene-Lycee-2021.zip" -exe "Programmes\Phylo.exe" -app "Phylogene" -InstallZip -zip "paleoterre_el32.zip" -exe "paleoTerre.exe" -app "PaleoTerre" -InstallExeSetup -app "Eduanat2_Setup_2.0.0.exe" -InstallZip -zip "couvac_exe.zip" -exe "couvac.exe" -app "Couvac" -InstallZipSetup -zip "ACDLabs202311_ChemSketch_FInstall.zip" -exe "setup.exe" - - -# Update Windows -Install-Module -Name PSWindowsUpdate -Force -Get-WindowsUpdate -ForceInstall -Install-WindowsUpdate -AcceptAll -AutoReboot diff --git a/Old Script/setupScriptLaboOld.ps1 b/Old Script/setupScriptLaboOld.ps1 deleted file mode 100755 index a48d15b..0000000 --- a/Old Script/setupScriptLaboOld.ps1 +++ /dev/null @@ -1,304 +0,0 @@ -Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1')) -# remove bloatware -$apps = @( - "Microsoft.549981C3F5F10" - "Microsoft.3DBuilder" - "Microsoft.Appconnector" - "Microsoft.BingFinance" - "Microsoft.BingNews" - "Microsoft.BingSports" - "Microsoft.BingTranslator" - "Microsoft.BingWeather" - "Microsoft.FreshPaint" - "Microsoft.GamingServices" - "Microsoft.Microsoft3DViewer" - "Microsoft.MicrosoftOfficeHub" - "Microsoft.MicrosoftPowerBIForWindows" - "Microsoft.MicrosoftSolitaireCollection" - "Microsoft.MicrosoftStickyNotes" - "Microsoft.MinecraftUWP" - "Microsoft.NetworkSpeedTest" - "Microsoft.Office.OneNote" - "Microsoft.People" - "Microsoft.Print3D" - "Microsoft.SkypeApp" - "Microsoft.Wallet" - "Microsoft.WindowsAlarms" - "microsoft.windowscommunicationsapps" - "Microsoft.WindowsMaps" - "Microsoft.WindowsPhone" - "Microsoft.WindowsSoundRecorder" - "Microsoft.WindowsStore" - "Microsoft.Xbox.TCUI" - "Microsoft.XboxApp" - "Microsoft.XboxGameOverlay" - "Microsoft.XboxGamingOverlay" - "Microsoft.XboxSpeechToTextOverlay" - "Microsoft.YourPhone" - "Microsoft.ZuneMusic" - "Microsoft.ZuneVideo" - "Microsoft.CommsPhone" - "Microsoft.ConnectivityStore" - "Microsoft.GetHelp" - "Microsoft.Getstarted" - "Microsoft.Messaging" - "Microsoft.Office.Sway" - "Microsoft.OneConnect" - "Microsoft.WindowsFeedbackHub" - "Microsoft.Microsoft3DViewer" - "Microsoft.MSPaint" - "Microsoft.BingFoodAndDrink" - "Microsoft.BingHealthAndFitness" - "Microsoft.BingTravel" - "Microsoft.WindowsReadingList" - "Microsoft.MixedReality.Portal" - "Microsoft.ScreenSketch" - "Microsoft.XboxGamingOverlay" - "Microsoft.YourPhone" - "Microsoft.WindowsMaps" - "Microsoft.MixedReality.Portal" - "Microsoft.WindowsCamera" - "Microsoft.MicrosoftSolitaireCollection" - "Microsoft.MicrosoftStickyNotes" - "Microsoft.SkypeApp" - "Microsoft.Office.OneNote" - "Microsoft.WindowsStore" - "2FE3CB00.PicsArt-PhotoStudio" - "46928bounde.EclipseManager" - "4DF9E0F8.Netflix" - "613EBCEA.PolarrPhotoEditorAcademicEdition" - "6Wunderkinder.Wunderlist" - "7EE7776C.LinkedInforWindows" - "89006A2E.AutodeskSketchBook" - "9E2F88E3.Twitter" - "A278AB0D.DisneyMagicKingdoms" - "A278AB0D.MarchofEmpires" - "ActiproSoftwareLLC.562882FEEB491" - "CAF9E577.Plex" - "ClearChannelRadioDigital.iHeartRadio" - "D52A8D61.FarmVille2CountryEscape" - "D5EA27B7.Duolingo-LearnLanguagesforFree" - "DB6EA5DB.CyberLinkMediaSuiteEssentials" - "DolbyLaboratories.DolbyAccess" - "DolbyLaboratories.DolbyAccess" - "Drawboard.DrawboardPDF" - "Facebook.Facebook" - "Fitbit.FitbitCoach" - "Flipboard.Flipboard" - "GAMELOFTSA.Asphalt8Airborne" - "KeeperSecurityInc.Keeper" - "NORDCURRENT.COOKINGFEVER" - "PandoraMediaInc.29680B314EFC2" - "Playtika.CaesarsSlotsFreeCasino" - "ShazamEntertainmentLtd.Shazam" - "SlingTVLLC.SlingTV" - "SpotifyAB.SpotifyMusic" - "ThumbmunkeysLtd.PhototasticCollage" - "TuneIn.TuneInRadio" - "WinZipComputing.WinZipUniversal" - "XINGAG.XING" - "flaregamesGmbH.RoyalRevolt2" - "king.com.*" - "king.com.BubbleWitch3Saga" - "king.com.CandyCrushSaga" - "king.com.CandyCrushSodaSaga" - "5319275A.WhatsAppDesktop" - "Microsoft.Advertising.Xaml" - "Microsoft.549981C3F5F10" - "Microsoft.3DBuilder" - "Microsoft.Appconnector" - "Microsoft.BingFinance" - "Microsoft.BingNews" - "Microsoft.BingSports" - "Microsoft.BingTranslator" - "Microsoft.BingWeather" - "Microsoft.FreshPaint" - "Microsoft.GamingServices" - "Microsoft.Microsoft3DViewer" - "Microsoft.MicrosoftOfficeHub" - "Microsoft.MicrosoftPowerBIForWindows" - "Microsoft.MicrosoftSolitaireCollection" - "Microsoft.MicrosoftStickyNotes" - "Microsoft.MinecraftUWP" - "Microsoft.NetworkSpeedTest" - "Microsoft.Office.OneNote" - "Microsoft.People" - "Microsoft.Print3D" - "Microsoft.SkypeApp" - "Microsoft.Wallet" - "Microsoft.WindowsAlarms" - "microsoft.windowscommunicationsapps" - "Microsoft.WindowsMaps" - "Microsoft.WindowsPhone" - "Microsoft.WindowsSoundRecorder" - "Microsoft.WindowsStore" - "Microsoft.Xbox.TCUI" - "Microsoft.XboxApp" - "Microsoft.XboxGameOverlay" - "Microsoft.XboxGamingOverlay" - "Microsoft.XboxSpeechToTextOverlay" - "Microsoft.YourPhone" - "Microsoft.ZuneMusic" - "Microsoft.ZuneVideo" - "Microsoft.CommsPhone" - "Microsoft.ConnectivityStore" - "Microsoft.GetHelp" - "Microsoft.Getstarted" - "Microsoft.Messaging" - "Microsoft.Office.Sway" - "Microsoft.OneConnect" - "Microsoft.WindowsFeedbackHub" - "Microsoft.Microsoft3DViewer" - "Microsoft.MSPaint" - "Microsoft.BingFoodAndDrink" - "Microsoft.BingHealthAndFitness" - "Microsoft.BingTravel" - "Microsoft.WindowsReadingList" - "Microsoft.MixedReality.Portal" - "Microsoft.ScreenSketch" - "Microsoft.XboxGamingOverlay" - "Microsoft.YourPhone" - "Microsoft.WindowsMaps" - "Microsoft.MixedReality.Portal" - "Microsoft.WindowsCamera" - "Microsoft.MicrosoftSolitaireCollection" - "Microsoft.MicrosoftStickyNotes" - "Microsoft.SkypeApp" - "Microsoft.Office.OneNote" - "Microsoft.WindowsStore" -) - -foreach ($app in $apps) { - Write-Output "Trying to remove $app" - # Get the app version - $appVersion = (Get-AppxPackage -Name $app).Version - If ($appVersion){ - # If the apps is found, remove it - Get-AppxPackage -Name $app -AllUsers | Remove-AppxPackage -AllUsers - } - - # Remove the app from the local Windows Image to prevent re-install on new user accounts - Get-AppXProvisionedPackage -Online | Where-Object DisplayName -EQ $app | Remove-AppxProvisionedPackage -Online - # Cleanup Local App Data - $appPath="$Env:LOCALAPPDATA\Packages\$app*" - Remove-Item $appPath -Recurse -Force -ErrorAction 0 -} - -# Installing needed apps -choco install dotnet -y -choco install vcredist-all -y -choco install firefox -y -choco install 7zip -y -choco install onlyoffice -y -choco install googleearthpro -y -choco install adobereader -y -choco install sublimetext4 -y -choco install vlc -y -choco install audacity -y -choco install arduino -y -choco install avogadro -y - -Set-LocalUser -Name "Eleve" -PasswordNeverExpires $true -UserMayChangePassword $false -Password ([securestring]::new()) -$SecurePassword = ConvertTo-SecureString -String "IPRprof2398" -AsPlainText -Force -Set-LocalUser -Name "Prof" -PasswordNeverExpires $true -UserMayChangePassword $false -Password $SecurePassword -$SecurePassword = ConvertTo-SecureString -String "Lprsnm4ehk26-" -AsPlainText -Force -Set-LocalUser -Name "Admin" -PasswordNeverExpires $true -Password $SecurePassword - -Set-Location D:\Setup\Labo -Set-Location E:\Setup\Labo -Set-Location F:\Setup\Labo -Copy-Item -Path .\Software\* -Destination "C:\Program Files\" -Recurse -Copy-Item -Path .\Shortcut\* -Destination "C:\Users\Public\Desktop\" -Recurse -icacls "C:\Users\Public" /grant:r "Eleve:(OI)(CI)(R)" - - -# Function to load a user's HKU registry hive -function UserReg { - param ( - [string] $Username - ) - - # Get the list of user profiles on the computer - $UserProfiles = Get-WmiObject Win32_UserProfile | Where-Object { $_.Special -eq $false } - - # Search for the user profile based on the username - $UserProfile = $UserProfiles | Where-Object { $_.LocalPath.EndsWith("\$Username") } - - # Check if the user profile exists - if ($null -ne $UserProfile) { - # Construct the path to the user's NTUSER.DAT file (registry hive) - $UserSID = $UserProfile.SID - # Return the user's SID and HKU registry key - return $UserSID, "Registry::HKEY_USERS\$UserSID" - } else { - Write-Host "User profile for $Username not found." - return $null, $null - } -} - -$TargetUsername = "Eleve" -$UserSID, $UserHKUPath = UserReg -Username $TargetUsername - -if ($null -ne $UserSID -and $null -ne $UserHKUPath) { - # Restrict access to Settings - $ControlPanelKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" - $ControlPanelValueName = "NoControlPanel" - if (Test-Path -Path $ControlPanelKeyPath) { - $RegistryItem = Get-ItemProperty -Path $ControlPanelKeyPath - if ($RegistryItem.PSObject.Properties.Name -contains $ControlPanelValueName) { - Set-ItemProperty -Path $ControlPanelKeyPath -Name $ControlPanelValueName -Value 1 - } else { - New-ItemProperty -Path $ControlPanelKeyPath -Name $ControlPanelValueName -Value 1 -PropertyType DWord - } - } else { - New-Item -Path $ControlPanelKeyPath -Force - New-ItemProperty -Path $ControlPanelKeyPath -Name $ControlPanelValueName -Value 1 -PropertyType DWord - } - - # Disable access to regedit - $REGKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\System" - $REGValueName = "DisableRegistryTools" - if (Test-Path -Path $REGKeyPath) { - $RegistryItem = Get-ItemProperty -Path $REGKeyPath - if ($RegistryItem.PSObject.Properties.Name -contains $REGValueName) { - Set-ItemProperty -Path $REGKeyPath -Name $REGValueName -Value 1 - } else { - New-ItemProperty -Path $REGKeyPath -Name $REGValueName -Value 1 -PropertyType DWord - } - } else { - New-Item -Path $REGKeyPath -Force - New-ItemProperty -Path $REGKeyPath -Name $REGValueName -Value 1 -PropertyType DWord - } - - # Restrict access to Command Prompt - $CMDKeyPath = "$UserHKUPath\Software\Policies\Microsoft\Windows\System" - $CMDValueName = "DisableCMD" - if (Test-Path -Path $CMDKeyPath) { - $RegistryItem = Get-ItemProperty -Path $CMDKeyPath - if ($RegistryItem.PSObject.Properties.Name -contains $CMDValueName) { - Set-ItemProperty -Path $CMDKeyPath -Name $CMDValueName -Value 1 - } else { - New-ItemProperty -Path $CMDKeyPath -Name $CMDValueName -Value 1 -PropertyType DWord - } - } else { - New-Item -Path $CMDKeyPath -Force - New-ItemProperty -Path $CMDKeyPath -Name $CMDValueName -Value 1 -PropertyType DWord - } - - # Add entries to DisallowRun for cmd.exe and powershell.exe - $DisallowRunKeyPath = "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\DisallowRun" - if (Test-Path -Path $DisallowRunKeyPath) { - Set-ItemProperty -Path "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "DisallowRun" -Value 1 - New-ItemProperty -Path $DisallowRunKeyPath -Name "1" -Value "cmd.exe" -PropertyType String - New-ItemProperty -Path $DisallowRunKeyPath -Name "2" -Value "powershell.exe" -PropertyType String - New-ItemProperty -Path $DisallowRunKeyPath -Name "3" -Value "powershell_ise.exe" -PropertyType String - } else { - New-Item -Path $DisallowRunKeyPath -Force - Set-ItemProperty -Path "$UserHKUPath\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "DisallowRun" -Value 1 - New-ItemProperty -Path $DisallowRunKeyPath -Name "1" -Value "cmd.exe" -PropertyType String - New-ItemProperty -Path $DisallowRunKeyPath -Name "2" -Value "powershell.exe" -PropertyType String - New-ItemProperty -Path $DisallowRunKeyPath -Name "3" -Value "powershell_ise.exe" -PropertyType String - } -} else { - Write-Host "Unable to get the user's HKU registry." -} diff --git a/Setup files/SalsaJ_2_3.exe b/Setup files/SalsaJ_2_3.exe new file mode 100755 index 0000000..0973660 Binary files /dev/null and b/Setup files/SalsaJ_2_3.exe differ diff --git a/setupApps.ps1 b/setupApps.ps1 index 3352b9a..0bfb47d 100644 --- a/setupApps.ps1 +++ b/setupApps.ps1 @@ -143,6 +143,7 @@ function InstallApps { InstallZipMsi -zip "Anagene.zip" -msi "Anagene.msi" InstallZip -zip "EduPython.zip" -exe "EduPython.exe" -app "EduPython" InstallZip -zip "rastop.zip" -exe "RasTop.exe" -app "RasTop" + InstallExe -app "SalsaJ_2_3.exe" } "Info" { InstallMsi -app "EV3_Classroom_Windows_1.5.3_Global.msi" diff --git a/setupChoco.ps1 b/setupChoco.ps1 index 738ccc3..0f0600d 100644 --- a/setupChoco.ps1 +++ b/setupChoco.ps1 @@ -12,6 +12,7 @@ function InstallChocoApps { "Labo" { choco install dotnet -y choco install vcredist-all -y + choco install javaruntime -y choco install firefox -y choco install 7zip -y choco install googleearthpro -y diff --git a/setupScript.ps1 b/setupScript.ps1 index 4f8358f..1e20f72 100644 --- a/setupScript.ps1 +++ b/setupScript.ps1 @@ -12,18 +12,6 @@ $scriptUrls = @( ($baseUrl + "setupWDAC.ps1") ) -# Old ImportModules -#Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Force -#foreach ($url in $ScriptUrls) { -# $fileName = Split-Path -Leaf $url -# $localFile = Join-Path -Path $(Join-Path $env:LOCALAPPDATA "Temp") -ChildPath $fileName -# Write-Host "Downloading script $fileName to $localFile" -# Invoke-WebRequest -Uri $url -OutFile $localFile -UseBasicParsing -# Write-Host "Importing script from $localFile" -# . $localFile -#} - -# New ImportModules Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Force foreach ($ScriptUrl in $ScriptUrls) { try {