PowerShell/scripts/list-user-accounts.ps1

21 lines
391 B
PowerShell
Raw Normal View History

2023-10-31 12:33:36 +01:00
<#
2022-10-25 15:58:33 +02:00
.SYNOPSIS
Lists user accounts
.DESCRIPTION
This PowerShell script lists the user accounts on the local computer.
.EXAMPLE
2023-08-06 21:35:36 +02:00
PS> ./list-user-accounts.ps1
2022-10-25 15:58:33 +02:00
.LINK
https://github.com/fleschutz/PowerShell
.NOTES
Author: Markus Fleschutz | License: CC0
#>
try {
2022-10-25 16:21:16 +02:00
& net user
2022-10-25 15:58:33 +02:00
exit 0 # success
} catch {
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
exit 1
2023-08-06 21:35:36 +02:00
}