First version of unified script
This commit is contained in:
121
setupApps.ps1
Normal file
121
setupApps.ps1
Normal file
@@ -0,0 +1,121 @@
|
||||
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()
|
||||
}
|
||||
|
||||
function CreateURLShortcut {
|
||||
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()
|
||||
}
|
||||
|
||||
function InstallApps {
|
||||
param (
|
||||
[string] $Type
|
||||
)
|
||||
|
||||
switch ($Type) {
|
||||
"Labo" {
|
||||
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"
|
||||
}
|
||||
"Info" {
|
||||
InstallZip -zip "simulation.zip" -exe "simulation.exe" -app "Simulation Domotique"
|
||||
InstallMsi -app "EV3_Classroom_Windows_1.5.3_Global.msi"
|
||||
InstallZip -zip "RobotProg.zip" -exe "RobotProg.exe" -app "RobotProg"
|
||||
|
||||
CreateURLShortcut -ShortcutName "Office 365" -TargetUrl "https://office.com/"
|
||||
CreateURLShortcut -ShortcutName "Ecole Direct" -TargetUrl "https://ecoledirecte.com/"
|
||||
CreateURLShortcut -ShortcutName "PIX" -TargetUrl "https://pix.fr/"
|
||||
CreateURLShortcut -ShortcutName "Framindmap" -TargetUrl "https://framindmap.org/"
|
||||
}
|
||||
"Laptop" {
|
||||
Write-Host "Nothing to install."
|
||||
}
|
||||
default { Write-Host "Invalid selection." }
|
||||
}
|
||||
}
|
||||
48
setupChoco.ps1
Normal file
48
setupChoco.ps1
Normal file
@@ -0,0 +1,48 @@
|
||||
function InstallChoco {
|
||||
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'))
|
||||
}
|
||||
|
||||
function ChocoInstallApps {
|
||||
param (
|
||||
[string] $Type
|
||||
)
|
||||
|
||||
switch ($Type) {
|
||||
"Labo" {
|
||||
choco install dotnet -y
|
||||
choco install vcredist-all -y
|
||||
choco install firefox -y
|
||||
choco install 7zip -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
|
||||
}
|
||||
"Info" {
|
||||
choco install dotnet -y
|
||||
choco install vcredist-all -y
|
||||
choco install firefox -y
|
||||
choco install 7zip -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
|
||||
choco install arduino -y --install-arguments="/allusers"
|
||||
choco install ganttproject -y
|
||||
}
|
||||
"Laptop" {
|
||||
choco install dotnet -y
|
||||
choco install vcredist-all -y
|
||||
choco install firefox -y
|
||||
choco install 7zip -y
|
||||
choco install vlc -y
|
||||
}
|
||||
default { Write-Host "Invalid selection." }
|
||||
}
|
||||
}
|
||||
80
setupOffice.ps1
Normal file
80
setupOffice.ps1
Normal file
@@ -0,0 +1,80 @@
|
||||
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."
|
||||
InstallOffice
|
||||
}
|
||||
ActivateWindowsOffice
|
||||
}
|
||||
|
||||
function InstallOffice {
|
||||
$imagePath = Join-Path $tmpPath "O365ProPlusRetail.img"
|
||||
$setupPath = Join-Path $driveLetter '\Office\Setup64.exe'
|
||||
|
||||
Write-Host "Starting Microsoft Office Installation..."
|
||||
|
||||
if (Test-Path -Path $imagePath -PathType Leaf -and Test-Path -Path $setupPath -PathType Leaf) {
|
||||
$mountResult = Mount-DiskImage -ImagePath $imagePath -PassThru
|
||||
$driveLetter = ($mountResult | Get-Volume).DriveLetter
|
||||
Start-Process -FilePath $setupPath -Wait
|
||||
} else {
|
||||
Write-Host "Office setup files not found."
|
||||
}
|
||||
}
|
||||
|
||||
function DownloadScriptFromUrls {
|
||||
param (
|
||||
[string[]] $Urls
|
||||
)
|
||||
|
||||
foreach ($url in $Urls) {
|
||||
try {
|
||||
$response = Invoke-WebRequest -Uri $url -UseBasicParsing
|
||||
return $response
|
||||
} catch {
|
||||
Write-Host "Failed to download script from $url"
|
||||
}
|
||||
}
|
||||
return $null
|
||||
}
|
||||
|
||||
Function ActivateWindowsOffice {
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
|
||||
|
||||
$DownloadURLs = @(
|
||||
'https://git.justw.tf/Lightemerald/microsoft-activation-scripts/raw/branch/master/MAS/All-In-One-Version/MAS_AIO.cmd',
|
||||
'https://raw.githubusercontent.com/massgravel/Microsoft-Activation-Scripts/master/MAS/All-In-One-Version/MAS_AIO.cmd',
|
||||
'https://bitbucket.org/WindowsAddict/microsoft-activation-scripts/raw/master/MAS/All-In-One-Version/MAS_AIO.cmd'
|
||||
)
|
||||
|
||||
$rand = Get-Random -Maximum 99999999
|
||||
$isAdmin = [bool]([Security.Principal.WindowsIdentity]::GetCurrent().Groups -match 'S-1-5-32-544')
|
||||
$FilePath = if ($isAdmin) { "$env:SystemRoot\Temp\MAS_$rand.cmd" } else { "$env:TEMP\MAS_$rand.cmd" }
|
||||
|
||||
$response = DownloadScriptFromUrls -Urls $DownloadURLs
|
||||
|
||||
$ScriptArgs = "$args "
|
||||
$prefix = "@REM $rand `r`n"
|
||||
$content = $prefix + $response
|
||||
Set-Content -Path $FilePath -Value $content
|
||||
|
||||
Start-Process $FilePath $ScriptArgs -Wait
|
||||
|
||||
$FilePaths = @("$env:TEMP\MAS*.cmd", "$env:SystemRoot\Temp\MAS*.cmd")
|
||||
foreach ($FilePath in $FilePaths) { Get-Item $FilePath | Remove-Item }
|
||||
}
|
||||
87
setupReg.ps1
Normal file
87
setupReg.ps1
Normal file
@@ -0,0 +1,87 @@
|
||||
# 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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function SetupEleveReg {
|
||||
param (
|
||||
[string] $username
|
||||
)
|
||||
$UserSID, $UserHKUPath = UserReg -Username $username
|
||||
|
||||
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."
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function EnableRDP {
|
||||
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name "fDenyTSConnections" -Value 0
|
||||
Enable-NetFirewallRule -Group "@FirewallAPI.dll,-28752"
|
||||
}
|
||||
@@ -1,13 +1,63 @@
|
||||
function Import-ScriptsFromUrls {
|
||||
param (
|
||||
[string[]] $ScriptUrls
|
||||
)
|
||||
|
||||
foreach ($url in $ScriptUrls) {
|
||||
$scriptContent = Invoke-WebRequest -Uri $url
|
||||
Invoke-Expression -Command $scriptContent.Content
|
||||
}
|
||||
}
|
||||
$baseUrl = "https://git.justw.tf/Lightemerald/setup-script/raw/branch/main/"
|
||||
$scriptUrls = @(
|
||||
($baseUrl + "setupTmp.ps1"),
|
||||
($baseUrl + "setupOffice.ps1"),
|
||||
($baseUrl + "setupUsers.ps1"),
|
||||
($baseUrl + "setupReg.ps1"),
|
||||
($baseUrl + "setupChoco.ps1"),
|
||||
($baseUrl + "setupApps.ps1"),
|
||||
($baseUrl + "setupUpdate.ps1")
|
||||
)
|
||||
|
||||
Import-ScriptsFromUrls -ScriptUrls $scriptUrls
|
||||
|
||||
function SetupLabo {
|
||||
Write-Host "Performing Labo Installation..."
|
||||
DownloadFiles -Type "Labo"
|
||||
CheckOfficeInstall
|
||||
SetupUsers
|
||||
SetupEleveReg -username "Eleve"
|
||||
EnableRDP
|
||||
InstallChoco
|
||||
ChocoInstallApps -Type "Labo"
|
||||
InstallApps -Type "Labo"
|
||||
UpdateWindows
|
||||
}
|
||||
|
||||
function SetupInfo {
|
||||
Write-Host "Performing Info Installation..."
|
||||
DownloadFiles -Type "Info"
|
||||
CheckOfficeInstall
|
||||
SetupUsers
|
||||
SetupEleveReg -username "Eleve"
|
||||
EnableRDP
|
||||
InstallChoco
|
||||
ChocoInstallApps -Type "Info"
|
||||
InstallApps -Type "Info"
|
||||
UpdateWindows
|
||||
}
|
||||
|
||||
function SetupLaptop {
|
||||
Write-Host "Performing Laptop Installation..."
|
||||
DownloadFiles -Type "Laptop"
|
||||
CheckOfficeInstall
|
||||
SetupUsers
|
||||
SetupEleveReg -username "Eleve"
|
||||
EnableRDP
|
||||
InstallChoco
|
||||
ChocoInstallApps -Type "Laptop"
|
||||
InstallApps -Type "Laptop"
|
||||
UpdateWindows
|
||||
}
|
||||
|
||||
function Show-InstallationMenu {
|
||||
|
||||
106
setupTmp.ps1
Normal file
106
setupTmp.ps1
Normal file
@@ -0,0 +1,106 @@
|
||||
$tmpPath = Join-Path $env:LOCALAPPDATA "Temp"
|
||||
|
||||
function DownloadFiles {
|
||||
param (
|
||||
[string] $Type
|
||||
)
|
||||
|
||||
switch ($Type) {
|
||||
"Labo" {
|
||||
$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"
|
||||
}
|
||||
)
|
||||
}
|
||||
"Info" {
|
||||
$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"
|
||||
},
|
||||
@{
|
||||
Url = "https://officecdn.microsoft.com/db/492350f6-3a01-4f97-b9c0-c7c6ddf67d60/media/fr-fr/O365ProPlusRetail.img"
|
||||
FileName = "O365ProPlusRetail.img"
|
||||
}
|
||||
)
|
||||
}
|
||||
"Laptop" {
|
||||
$filesToDownload = @(
|
||||
@{
|
||||
Url = "https://officecdn.microsoft.com/db/492350f6-3a01-4f97-b9c0-c7c6ddf67d60/media/fr-fr/O365ProPlusRetail.img"
|
||||
FileName = "O365ProPlusRetail.img"
|
||||
}
|
||||
)
|
||||
}
|
||||
default { Write-Host "Invalid selection." }
|
||||
}
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
6
setupUpdate.ps1
Normal file
6
setupUpdate.ps1
Normal file
@@ -0,0 +1,6 @@
|
||||
function UpdateWindows {
|
||||
Disable-WindowsOptionalFeature -online -NoRestart -FeatureName internet-explorer-optional-amd64
|
||||
Install-Module -Name PSWindowsUpdate -Force
|
||||
Get-WindowsUpdate -ForceInstall
|
||||
Install-WindowsUpdate -AcceptAll -AutoReboot
|
||||
}
|
||||
38
setupUsers.ps1
Normal file
38
setupUsers.ps1
Normal file
@@ -0,0 +1,38 @@
|
||||
# Setup users
|
||||
|
||||
|
||||
function SetupUsers {
|
||||
$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
|
||||
Write-Host "You need to login to Eleve in order for its files and registry to be setup."
|
||||
Write-Host "Press Enter to continue..."
|
||||
$null = Read-Host
|
||||
Write-Host "Continuing the script..."
|
||||
} 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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user