mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-01-13 01:18:31 +01:00
Update new-user.ps1
This commit is contained in:
parent
cee7a19571
commit
33e419ff5b
@ -5,7 +5,7 @@
|
|||||||
This PowerShell script creates a new user account with an encrypted home directory.
|
This PowerShell script creates a new user account with an encrypted home directory.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./new-user.ps1 Joe
|
PS> ./new-user.ps1 Joe
|
||||||
✔️ Created new user 'Joe' with encrypted home directory in 11s.
|
✔️ Created user account 'Joe' with encrypted home directory in 11s.
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -19,13 +19,14 @@ try {
|
|||||||
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
$stopWatch = [system.diagnostics.stopwatch]::startNew()
|
||||||
|
|
||||||
if ($IsLinux) {
|
if ($IsLinux) {
|
||||||
|
& sudo apt install ecryptfs-utils
|
||||||
& sudo adduser --encrypt-home $username
|
& sudo adduser --encrypt-home $username
|
||||||
} else {
|
} else {
|
||||||
throw "Not supported yet"
|
throw "Not supported yet"
|
||||||
}
|
}
|
||||||
|
|
||||||
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
[int]$elapsed = $stopWatch.Elapsed.TotalSeconds
|
||||||
"✔️ Created new user '$username' with encrypted home directory in $($elapsed)s."
|
"✔️ Created user account '$username' with encrypted home directory in $($elapsed)s."
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user