From 7cc8831c19d5a20a920cd5b99c4e3e2a616cdba6 Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Tue, 16 Feb 2021 16:12:51 +0100 Subject: [PATCH] Added list-network-shares.ps1 --- Data/scripts.csv | 1 + README.md | 1 + Scripts/list-network-shares.ps1 | 15 +++++++++++++++ 3 files changed, 17 insertions(+) create mode 100755 Scripts/list-network-shares.ps1 diff --git a/Data/scripts.csv b/Data/scripts.csv index 4042bc23..57e7af1c 100644 --- a/Data/scripts.csv +++ b/Data/scripts.csv @@ -45,6 +45,7 @@ list-unused-files.ps1, lists unused files in a directory tree list-cmdlets.ps1, lists the PowerShell cmdlets list-earthquakes.ps1, lists earthquakes with magnitude >= 6.0 for the last 30 days list-modules.ps1, lists the PowerShell modules +list-network-shares.ps1, lists the network shares of the local computer list-news.ps1, lists the latest news list-os-releases.ps1, lists OS releases and download URL list-printers.ps1, lists all printer known to the computer diff --git a/README.md b/README.md index 8fa17a39..058ac20c 100644 --- a/README.md +++ b/README.md @@ -51,6 +51,7 @@ Table of Contents * [list-cmdlets.ps1](Scripts/list-cmdlets.ps1) - lists the PowerShell cmdlets * [list-earthquakes.ps1](Scripts/list-earthquakes.ps1) - lists earthquakes with magnitude >= 6.0 for the last 30 days * [list-modules.ps1](Scripts/list-modules.ps1) - lists the PowerShell modules +* [list-network-shares.ps1](Scripts/list-network-shares.ps1) - lists the network shares of the local computer * [list-news.ps1](Scripts/list-news.ps1) - lists the latest news * [list-os-releases.ps1](Scripts/list-os-releases.ps1) - lists OS releases and download URL * [list-printers.ps1](Scripts/list-printers.ps1) - lists all printer known to the computer diff --git a/Scripts/list-network-shares.ps1 b/Scripts/list-network-shares.ps1 new file mode 100755 index 00000000..30e874f1 --- /dev/null +++ b/Scripts/list-network-shares.ps1 @@ -0,0 +1,15 @@ +#!/bin/powershell +<# +.SYNTAX ./list-network-shares.ps1 +.DESCRIPTION lists the network shares of the local computer +.LINK https://github.com/fleschutz/PowerShell +.NOTES Author: Markus Fleschutz / License: CC0 +#> + +try { + get-wmiobject win32_share | where {$_.name -NotLike "*$"} + exit 0 +} catch { + write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" + exit 1 +}