New-UtilityUser
Create a new user
param([string]$username = "")
try {
if ($username -eq "") { $username = Read-Host "Enter the new user name" }
$stopWatch = [system.diagnostics.stopwatch]::startNew()
if ($IsLinux) {
& sudo apt install ecryptfs-utils
& sudo adduser --encrypt-home $username
} else {
throw "Not supported yet"
}
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
"? Created user account '$username' with encrypted home directory in $($elapsed)s."
exit 0 # success
} catch {
"?? ERROR: $($Error[0]) (script line $($_.InvocationInfo.ScriptLineNumber))"
exit 1
}