Yanor.net/
Wiki
Blog
GitHub
Sandbox
開始行:
* コマンドレットの探し方 [#z606f7ca]
** 命題 [#k7cb4fb8]
- マックアドレスを調べるコマンドレットを探してみる。
** 手順 [#fc7b1ee6]
*** 1. Get-Commandで関係しそうなコマンドレットをある程度...
PS brazil> Get-Command -Verb get -Noun *net*
CommandType Name ...
----------- ---- ...
Function Get-BCNetworkConfiguration ...
Function Get-DtcNetworkSetting ...
Function Get-HnsNetwork ...
Function Get-Net6to4Configuration ...
Function Get-NetAdapter ...
Function Get-NetAdapterAdvancedProperty ...
Function Get-NetAdapterBinding ...
Function Get-NetAdapterChecksumOffload ...
(略)
Cmdlet Get-VMNetworkAdapterRoutingDomainMapping...
Cmdlet Get-VMNetworkAdapterTeamMapping ...
Cmdlet Get-VMNetworkAdapterVlan ...
- 情報を取得するから、-VerbはGetで間違いない。マックアド...
PS> Get-Command -Verb get -Noun *net* -Module NetAdapter
CommandType Name ...
----------- ---- ...
Function Get-NetAdapter ...
Function Get-NetAdapterAdvancedProperty ...
Function Get-NetAdapterBinding ...
(略)
- 関係なさそうなモジュールは除外していく(上のHyper-Vなど...
- -ModuleにNetAdapterを指定して、再度検索する。
PS> $list = Get-Command -Verb get -Noun *net* -Module Ne...
- 検索結果のコマンドレット一覧をいったん$listに入れる。
*** 2. Get-Helpで絞り込んだコマンドレット一覧のシノプシス...
PS> $list | Get-Help | select name, synopsis
Name Synopsis
---- --------
Get-NetAdapter Gets the bas...
Get-NetAdapterAdvancedProperty Gets the adv...
Get-NetAdapterBinding Gets a list ...
(略)
- シノプシスを読むと、Get-NetAdapterがそれっぽいことがわ...
*** 3. Get-Memberであたりをつけたコマンドレットのメンバー...
PS> Get-NetAdapter | gm -Name macaddress
TypeName: Microsoft.Management.Infrastructure.CimInst...
Name MemberType Definition
---- ---------- ----------
MacAddress ScriptProperty System.Object MacAddress {get=...
- Get-NetAdapterのメンバーにmacaddressがないか調べると、...
** 結論 [#a0f9638a]
- Get-Command、Get-Help、Get-Memberを使う。
- コマンドレットのVerbとNounを意識すると見つけやすい。
終了行:
* コマンドレットの探し方 [#z606f7ca]
** 命題 [#k7cb4fb8]
- マックアドレスを調べるコマンドレットを探してみる。
** 手順 [#fc7b1ee6]
*** 1. Get-Commandで関係しそうなコマンドレットをある程度...
PS brazil> Get-Command -Verb get -Noun *net*
CommandType Name ...
----------- ---- ...
Function Get-BCNetworkConfiguration ...
Function Get-DtcNetworkSetting ...
Function Get-HnsNetwork ...
Function Get-Net6to4Configuration ...
Function Get-NetAdapter ...
Function Get-NetAdapterAdvancedProperty ...
Function Get-NetAdapterBinding ...
Function Get-NetAdapterChecksumOffload ...
(略)
Cmdlet Get-VMNetworkAdapterRoutingDomainMapping...
Cmdlet Get-VMNetworkAdapterTeamMapping ...
Cmdlet Get-VMNetworkAdapterVlan ...
- 情報を取得するから、-VerbはGetで間違いない。マックアド...
PS> Get-Command -Verb get -Noun *net* -Module NetAdapter
CommandType Name ...
----------- ---- ...
Function Get-NetAdapter ...
Function Get-NetAdapterAdvancedProperty ...
Function Get-NetAdapterBinding ...
(略)
- 関係なさそうなモジュールは除外していく(上のHyper-Vなど...
- -ModuleにNetAdapterを指定して、再度検索する。
PS> $list = Get-Command -Verb get -Noun *net* -Module Ne...
- 検索結果のコマンドレット一覧をいったん$listに入れる。
*** 2. Get-Helpで絞り込んだコマンドレット一覧のシノプシス...
PS> $list | Get-Help | select name, synopsis
Name Synopsis
---- --------
Get-NetAdapter Gets the bas...
Get-NetAdapterAdvancedProperty Gets the adv...
Get-NetAdapterBinding Gets a list ...
(略)
- シノプシスを読むと、Get-NetAdapterがそれっぽいことがわ...
*** 3. Get-Memberであたりをつけたコマンドレットのメンバー...
PS> Get-NetAdapter | gm -Name macaddress
TypeName: Microsoft.Management.Infrastructure.CimInst...
Name MemberType Definition
---- ---------- ----------
MacAddress ScriptProperty System.Object MacAddress {get=...
- Get-NetAdapterのメンバーにmacaddressがないか調べると、...
** 結論 [#a0f9638a]
- Get-Command、Get-Help、Get-Memberを使う。
- コマンドレットのVerbとNounを意識すると見つけやすい。
ページ名: