From 3aefcfd2a07a1b67bc9b7022edf67a73853c511d Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Tue, 25 Oct 2022 15:58:33 +0200 Subject: [PATCH] Add list-user-accounts.ps1 --- Scripts/list-user-accounts.ps1 | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 Scripts/list-user-accounts.ps1 diff --git a/Scripts/list-user-accounts.ps1 b/Scripts/list-user-accounts.ps1 new file mode 100644 index 00000000..f68a872b --- /dev/null +++ b/Scripts/list-user-accounts.ps1 @@ -0,0 +1,20 @@ +<# +.SYNOPSIS + Lists user accounts +.DESCRIPTION + This PowerShell script lists the user accounts on the local computer. +.EXAMPLE + PS> ./list-user-accounts +.LINK + https://github.com/fleschutz/PowerShell +.NOTES + Author: Markus Fleschutz | License: CC0 +#> + +try { + net user + exit 0 # success +} catch { + "⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +} \ No newline at end of file