Reorganisation of the setup
- Autounattend files moved to Autounattend folder - WDAC files moved to WDAC folder - Added WDAC check to setupScript - Moved RDP to setupRDP - Moved Activate to setupActivate - Added online setup of Office with offline fallback - Changed setupUsers to be more standard and allow customisation - Added rastop setup
This commit is contained in:
@@ -34,4 +34,26 @@ function SetupUsers {
|
||||
Write-Host "User $username already exists. Configuring the user..."
|
||||
Set-LocalUser -Name $username -PasswordNeverExpires $true -Password $SecurePassword
|
||||
}
|
||||
}
|
||||
|
||||
function SetupUser {
|
||||
param (
|
||||
[string] $username,
|
||||
[string] $password,
|
||||
[string] $description,
|
||||
[string] $group
|
||||
)
|
||||
if ($password -eq "") {
|
||||
$SecurePassword = ConvertTo-SecureString -String $password -AsPlainText -Force
|
||||
} else {
|
||||
$SecurePassword = [securestring]::new()
|
||||
}
|
||||
if ($null -eq $(Get-LocalUser -Name $username -ErrorAction SilentlyContinue)) {
|
||||
Write-Host "User $username doesn't exist. Creating the user..."
|
||||
New-LocalUser -Name $username -Description $description -Password $SecurePassword -PasswordNeverExpires -UserMayNotChangePassword
|
||||
Add-LocalGroupMember -Group $group -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