mirror of
https://github.com/fleschutz/PowerShell.git
synced 2025-04-09 01:38:26 +02:00
Updated list-network-shares.ps1
This commit is contained in:
parent
c8a11f61bc
commit
bd3b301072
@ -18,6 +18,7 @@
|
|||||||
Write-Host "`n N E T W O R K" -foregroundColor green
|
Write-Host "`n N E T W O R K" -foregroundColor green
|
||||||
& "$PSScriptRoot/check-firewall"
|
& "$PSScriptRoot/check-firewall"
|
||||||
& "$PSScriptRoot/list-local-ip.ps1"
|
& "$PSScriptRoot/list-local-ip.ps1"
|
||||||
|
& "$PSScriptRoot/list-network-shares.ps1"
|
||||||
& "$PSScriptRoot/ping-local-devices.ps1"
|
& "$PSScriptRoot/ping-local-devices.ps1"
|
||||||
& "$PSScriptRoot/check-vpn.ps1"
|
& "$PSScriptRoot/check-vpn.ps1"
|
||||||
& "$PSScriptRoot/list-internet-ip.ps1"
|
& "$PSScriptRoot/list-internet-ip.ps1"
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
<#
|
<#
|
||||||
.SYNOPSIS
|
.SYNOPSIS
|
||||||
Lists the local network shares
|
Lists the network shares
|
||||||
.DESCRIPTION
|
.DESCRIPTION
|
||||||
This PowerShell script lists all network shares of the local computer.
|
This PowerShell script lists all network shares (aka "shared folders") of the local computer.
|
||||||
.EXAMPLE
|
.EXAMPLE
|
||||||
PS> ./list-network-shares.ps1
|
PS> ./list-network-shares.ps1
|
||||||
|
✅ Network share \\LAPTOP\Public mapped to: 📂D:\Public ("Public folder for file transfer")
|
||||||
Name Path Description
|
|
||||||
---- ---- -----------
|
|
||||||
Public C:\Public Public folder for file transfer
|
|
||||||
.LINK
|
.LINK
|
||||||
https://github.com/fleschutz/PowerShell
|
https://github.com/fleschutz/PowerShell
|
||||||
.NOTES
|
.NOTES
|
||||||
@ -16,7 +13,14 @@
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Get-WmiObject win32_share | where {$_.name -NotLike "*$"}
|
if ($IsLinux) {
|
||||||
|
# TODO
|
||||||
|
} else {
|
||||||
|
$shares = Get-WmiObject win32_share | where {$_.name -NotLike "*$"}
|
||||||
|
foreach ($share in $shares) {
|
||||||
|
Write-Output "✅ Network share \\$(hostname)\$($share.Name) mapped to: 📂$($share.Path) (`"$($share.Description)`")"
|
||||||
|
}
|
||||||
|
}
|
||||||
exit 0 # success
|
exit 0 # success
|
||||||
} catch {
|
} catch {
|
||||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||||
|
Loading…
Reference in New Issue
Block a user