diff --git a/Data/scripts.csv b/Data/scripts.csv index 52b9647d..52ff6dda 100644 --- a/Data/scripts.csv +++ b/Data/scripts.csv @@ -46,6 +46,7 @@ list-random-passwords.ps1, prints a list of random passwords list-random-pins.ps1, prints a list of random PIN's list-scripts.ps1, lists the PowerShell scripts in this repository list-timezones.ps1, lists all time zones available +list-user-groups.ps1, lists all user groups locate-city.ps1, prints the geographic location of the given city locate-ipaddress.ps1, prints the geographic location of the given IP address locate-zip-code.ps1, prints the geographic location of the given zip-code diff --git a/README.md b/README.md index 2dbe5892..b57b682b 100644 --- a/README.md +++ b/README.md @@ -54,6 +54,7 @@ The following PowerShell scripts can be found in the [Scripts/](Scripts/) subfol * [list-random-pins.ps1](Scripts/list-random-pins.ps1) - prints a list of random PIN's * [list-scripts.ps1](Scripts/list-scripts.ps1) - lists the PowerShell scripts in this repository * [list-timezones.ps1](Scripts/list-timezones.ps1) - lists all time zones available +* [list-user-groups.ps1](Scripts/list-user-groups.ps1) - lists all user groups * [locate-city.ps1](Scripts/locate-city.ps1) - prints the geographic location of the given city * [locate-ipaddress.ps1](Scripts/locate-ipaddress.ps1) - prints the geographic location of the given IP address * [locate-zip-code.ps1](Scripts/locate-zip-code.ps1) - prints the geographic location of the given zip-code diff --git a/Scripts/list-user-groups.ps1 b/Scripts/list-user-groups.ps1 new file mode 100755 index 00000000..34fc45b5 --- /dev/null +++ b/Scripts/list-user-groups.ps1 @@ -0,0 +1,16 @@ +#!/snap/bin/powershell +<# +.SYNTAX ./list-user-groups.ps1 +.DESCRIPTION lists all user groups +.LINK https://github.com/fleschutz/PowerShell +.NOTES Author: Markus Fleschutz / License: CC0 +#> + +try { + Get-LocalGroup + Get-LocalGroupMember -name users + exit 0 +} catch { + write-error "ERROR in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +}