Update setupScriptInfo.ps1
This commit is contained in:
@@ -11,7 +11,7 @@ $filesToDownload = @(
|
||||
},
|
||||
@{
|
||||
Url = "https://cdn.discordapp.com/attachments/704760633379389533/1161288505390026772/simulation.zip"
|
||||
FileName = "Simulation Domotique.zip"
|
||||
FileName = "simulation.zip"
|
||||
},
|
||||
@{
|
||||
Url = "https://cdn.discordapp.com/attachments/704760633379389533/1161288504765059172/RobotProg.zip"
|
||||
@@ -27,7 +27,6 @@ foreach ($fileInfo in $filesToDownload) {
|
||||
}
|
||||
}
|
||||
|
||||
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'))
|
||||
|
||||
# Setup users
|
||||
$username = "Eleve"
|
||||
@@ -67,7 +66,9 @@ function UserReg {
|
||||
$UserProfile = $UserProfiles | Where-Object { $_.LocalPath.EndsWith("\$Username") }
|
||||
if ($UserProfile -ne $null) {
|
||||
$UserSID = $UserProfile.SID
|
||||
$HivePath = Join-Path -Path $UserProfile.LocalPath -ChildPath "NTUSER.DAT"
|
||||
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."
|
||||
@@ -95,8 +96,7 @@ function SetRegistry {
|
||||
}
|
||||
}
|
||||
|
||||
$TargetUsername = "Eleve"
|
||||
$UserSID, $UserHKUPath = UserReg -Username $TargetUsername
|
||||
$UserSID, $UserHKUPath = UserReg -Username "Eleve"
|
||||
# Add restriction
|
||||
if ($UserSID -ne $null -and $UserHKUPath -ne $null) {
|
||||
# Restrict access to Settings
|
||||
@@ -128,10 +128,90 @@ if ($UserSID -ne $null -and $UserHKUPath -ne $null) {
|
||||
foreach ($valueName in $applications) {
|
||||
New-ItemProperty -Path $DisallowRunPath -Name $valueName -Value $valueName -PropertyType String
|
||||
}
|
||||
REG UNLOAD HKEY_USERS\$UserSID -ErrorAction SilentlyContinue
|
||||
} 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
|
||||
}
|
||||
$appFilePath = Join-Path $tmpPath $app
|
||||
Copy-Item -Path $appFilePath -Destination $targetPath -Force
|
||||
createShortcut -exe $appFilePath -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 $tmpPath $zipName $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 $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()
|
||||
}
|
||||
|
||||
#Install Choco
|
||||
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'))
|
||||
|
||||
# Installing needed apps
|
||||
choco upgrade all -y
|
||||
choco install dotnet -y
|
||||
@@ -147,59 +227,35 @@ choco install audacity -y
|
||||
|
||||
choco install scratch -y --install-arguments="/allusers" --force
|
||||
choco install mblock -y
|
||||
|
||||
Write-Host 'Installing Simulation Domotique...'
|
||||
Expand-Archive -Path (Join-Path $tmpPath "Simulation Domotique.zip") -DestinationPath $env:ProgramFiles -Force
|
||||
if (Test-Path -Path $(Join-Path $env:ProgramFiles "simulation") -PathType Container) {
|
||||
if (Test-Path -Path $(Join-Path $env:ProgramFiles "Simulation Domotique") -PathType Container) {
|
||||
Remove-Item -Path $(Join-Path $env:ProgramFiles "Simulation Domotique") -Recurse -Force
|
||||
}
|
||||
Rename-Item -Path $(Join-Path $env:ProgramFiles "simulation") -NewName "Simulation Domotique"
|
||||
}
|
||||
$targetExePath = "C:\Program Files\Simulation Domotique\simulation.exe"
|
||||
$shortcutPath = (Join-Path $env:PUBLIC "Desktop\Simulation Domotique.lnk")
|
||||
$shell = New-Object -ComObject WScript.Shell
|
||||
$shortcut = $shell.CreateShortcut($shortcutPath)
|
||||
$shortcut.TargetPath = $targetExePath
|
||||
$shortcut.IconLocation = $targetExePath
|
||||
$shortcut.WorkingDirectory = (Get-Item $targetExePath).DirectoryName
|
||||
$shortcut.Save()
|
||||
|
||||
InstallZip -zip "simulation.zip" -exe "simulation.exe" -app "Simulation Domotique"
|
||||
choco install arduino -y --install-arguments="/allusers" --force
|
||||
choco install ganttproject -y
|
||||
$msiFilePath = Join-Path -Path $tmpPath -ChildPath "EV3_Classroom_Windows_1.5.3_Global.msi"
|
||||
Start-Process -FilePath "msiexec.exe" -ArgumentList "/i `"$msiFilePath`" /qn" -Wait
|
||||
Expand-Archive -Path (Join-Path $tmpPath RobotProg.zip) -DestinationPath $env:ProgramFiles -Force
|
||||
$targetExePath = "C:\Program Files\RobotProg\RobotProg.exe"
|
||||
$shortcutPath = (Join-Path $env:PUBLIC "Desktop\RobotProg.lnk")
|
||||
$shell = New-Object -ComObject WScript.Shell
|
||||
$shortcut = $shell.CreateShortcut($shortcutPath)
|
||||
$shortcut.TargetPath = $targetExePath
|
||||
$shortcut.IconLocation = $targetExePath
|
||||
$shortcut.WorkingDirectory = (Get-Item $targetExePath).DirectoryName
|
||||
$shortcut.Save()
|
||||
InstallMsi -app "EV3_Classroom_Windows_1.5.3_Global.msi"
|
||||
InstallZip -zip "RobotProg.zip" -exe "RobotProg.exe" -app "RobotProg"
|
||||
|
||||
# URL shortcut
|
||||
Disable-WindowsOptionalFeature -online -NoRestart -FeatureName internet-explorer-optional-amd64
|
||||
$wshShell = New-Object -ComObject "WScript.Shell"
|
||||
$urlShortcut = $wshShell.CreateShortcut((Join-Path $env:PUBLIC "Desktop\Office 365.url"))
|
||||
$urlShortcut.TargetPath = "https://office.com/"
|
||||
$urlShortcut.Save()
|
||||
$urlShortcut = $wshShell.CreateShortcut((Join-Path $env:PUBLIC "Desktop\Ecole Direct.url"))
|
||||
$urlShortcut.TargetPath = "https://ecoledirecte.com/"
|
||||
$urlShortcut.Save()
|
||||
$urlShortcut = $wshShell.CreateShortcut((Join-Path $env:PUBLIC "Desktop\PIX.url"))
|
||||
$urlShortcut.TargetPath = "https://pix.fr/"
|
||||
$urlShortcut.Save()
|
||||
$urlShortcut = $wshShell.CreateShortcut((Join-Path $env:PUBLIC "Desktop\Framindmap.url"))
|
||||
$urlShortcut.TargetPath = "https://framindmap.org/"
|
||||
$urlShortcut.Save()
|
||||
function Create-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()
|
||||
}
|
||||
|
||||
Create-DesktopShortcut -ShortcutName "Office 365" -TargetUrl "https://office.com/"
|
||||
Create-DesktopShortcut -ShortcutName "Ecole Direct" -TargetUrl "https://ecoledirecte.com/"
|
||||
Create-DesktopShortcut -ShortcutName "PIX" -TargetUrl "https://pix.fr/"
|
||||
Create-DesktopShortcut -ShortcutName "Framindmap" -TargetUrl "https://framindmap.org/"
|
||||
|
||||
# RDP
|
||||
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Value 0
|
||||
Enable-NetFirewallRule -Group "@FirewallAPI.dll,-28752"
|
||||
|
||||
# Update Windows
|
||||
Disable-WindowsOptionalFeature -online -NoRestart -FeatureName internet-explorer-optional-amd64
|
||||
Install-Module -Name PSWindowsUpdate -Force
|
||||
Get-WindowsUpdate -ForceInstall
|
||||
Install-WindowsUpdate -AcceptAll -AutoReboot
|
||||
|
||||
Reference in New Issue
Block a user