Skip to content

list-network-shares

List network shares

#Requires -Version 5.1

try {
	if ($IsLinux -or $IsMacOS) {
		# TODO
	} else {
		$shares = Get-WmiObject win32_share | where {$_.name -NotLike "*$"} 
		foreach ($share in $shares) {
			if ($share.Description -eq "") {
				Write-Host "✅ Folder $($share.Path) shared as: \\$(hostname)\$($share.Name)"
			} else {
				Write-Host "✅ Folder $($share.Path) shared as: \\$(hostname)\$($share.Name) ('$($share.Description)')"
			}
		}
	}
	exit 0
} catch {
throw
}

This script has no configurable parameters.

An interactive directory of PowerShell scripts.