From 7921cfcba1fab6125646e2f00b13ce33fefbe846 Mon Sep 17 00:00:00 2001 From: Lightemerald Date: Mon, 23 Oct 2023 08:52:46 +0000 Subject: [PATCH] Update setupScriptInfo.ps1 --- setupScriptInfo.ps1 | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/setupScriptInfo.ps1 b/setupScriptInfo.ps1 index 07425ef..fea1df0 100644 --- a/setupScriptInfo.ps1 +++ b/setupScriptInfo.ps1 @@ -30,11 +30,32 @@ 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 -Set-LocalUser -Name "Eleve" -PasswordNeverExpires $true -UserMayChangePassword $false -Password ([securestring]::new()) +$username = "Eleve" +if (-not (Test-Path "C:\Users\$username")) { + Write-Host "User $username doesn't exist. Creating the user..." + New-LocalUser -Name $username -Description "New User Account" -NoPassword -PasswordNeverExpires $true -UserMayChangePassword $false +} else { + Write-Host "User $username already exists." + Set-LocalUser -Name $username -PasswordNeverExpires $true -UserMayChangePassword $false -Password ([securestring]::new()) +} +$username = "Prof" $SecurePassword = ConvertTo-SecureString -String "IPRprof2398" -AsPlainText -Force -Set-LocalUser -Name "Prof" -PasswordNeverExpires $true -UserMayChangePassword $false -Password $SecurePassword +if (-not (Test-Path "C:\Users\$username")) { + Write-Host "User $username doesn't exist. Creating the user..." + New-LocalUser -Name $username -Description "New User Account" -Password $SecurePassword -PasswordNeverExpires $true -UserMayChangePassword $false +} else { + Write-Host "User $username already exists." + Set-LocalUser -Name $username -PasswordNeverExpires $true -UserMayChangePassword $false -Password $SecurePassword +} +$username = "Admin" $SecurePassword = ConvertTo-SecureString -String "Lprsnm4ehk26-" -AsPlainText -Force -Set-LocalUser -Name "Admin" -PasswordNeverExpires $true -Password $SecurePassword +if (-not (Test-Path "C:\Users\$username")) { + Write-Host "User $username doesn't exist. Creating the user..." + New-LocalUser -Name $username -Description "New User Account" -Password $SecurePassword -PasswordNeverExpires $true -UserMayChangePassword $false +} else { + Write-Host "User $username already exists." + Set-LocalUser -Name $username -PasswordNeverExpires $true -UserMayChangePassword $false -Password $SecurePassword +} # Function to load a user's HKU registry hive