0
function global:Get-Shares(){
<#
.SYNOPSIS
Get Shares
.DESCRIPTION
This function fetches all shares on the computer when you run get-shares localhost. If you
just run get-shares then it will show all the non-$ shares.
.LINK
You can use "et" to end the transcript.
.PARAMETER prefix
The prefix for the transcript file name. Default: PowerShell_get-shares
.EXAMPLE
}
#>
param (
[string]$Computername, [string]$Allshares
)
[AllowNull()]
$computername = 'localhost'
$Allshares = gwmi -Computer $computername -Class Win32_Share | Where-Object { $_.Name -notlike "*$" }
if ($ComputerName -eq 'localhost') {
gwmi -Computer $ComputerName -Class Win32_Share
}
else {
gwmi -Computer $computername -Class Win32_Share | Where-Object { $_.Name -notlike "*$" }
}
}
なぜ私のelseステートメントは機能しませんか?私は私が得る-株式を実行したり、株式を取得