mirror of
https://github.com/fleschutz/PowerShell.git
synced 2024-11-07 16:44:22 +01: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
|
||||
& "$PSScriptRoot/check-firewall"
|
||||
& "$PSScriptRoot/list-local-ip.ps1"
|
||||
& "$PSScriptRoot/list-network-shares.ps1"
|
||||
& "$PSScriptRoot/ping-local-devices.ps1"
|
||||
& "$PSScriptRoot/check-vpn.ps1"
|
||||
& "$PSScriptRoot/list-internet-ip.ps1"
|
||||
|
@ -1,14 +1,11 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Lists the local network shares
|
||||
Lists the network shares
|
||||
.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
|
||||
PS> ./list-network-shares.ps1
|
||||
|
||||
Name Path Description
|
||||
---- ---- -----------
|
||||
Public C:\Public Public folder for file transfer
|
||||
✅ Network share \\LAPTOP\Public mapped to: 📂D:\Public ("Public folder for file transfer")
|
||||
.LINK
|
||||
https://github.com/fleschutz/PowerShell
|
||||
.NOTES
|
||||
@ -16,7 +13,14 @@
|
||||
#>
|
||||
|
||||
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
|
||||
} catch {
|
||||
"⚠️ Error in line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"
|
||||
|
Loading…
Reference in New Issue
Block a user