2020/10/31 #共有リソースの表示

皆様おはようございます、

#猫でもできるPowerShell(備忘録)

#共有リソースの表示

PS> Get-SmbShare

Name ScopeName Path Description

---- --------- ---- -----------

ADMIN$ * C:\Windows Remote Admin

C$ * C:\ Default share

D$ * D:\ Default share

IPC$ * Remote IPC

自分の端末から共有しているリソースを調べられます

コマンドプロンプトで「net share」と打っていたやつです

PS> net share

Share name Resource Remark

-------------------------------------------------------------------------------

C$ C:\ Default share

D$ D:\ Default share

IPC$ Remote IPC

ADMIN$ C:\Windows Remote Admin

The command completed successfully.

結果は似たようなものですが、Countプロパティを取ってみると

PS> (Get-SmbShare).count

4

## 共有リソースの数を表示

PS> (net share).count

10

## 結果の行数を表示

オブジェクト指向とそうでないものの違いが出てきて興味深いです

ではまた;