コマンドレットを上書きする関数から、特定のコマンドレットが直接呼び出しを行うためのモジュールを特定する方法を教えてください。特定のコマンドレットのモジュールを検索するにはどうすればよいですか?
たとえば、Start-TranscriptがMicrosoft.Powershell.Hostに存在することを確認するにはどうすればよいですか?
get-module Start-Transcript
は、以下の答えのために何
更新が得られません。
PS C:\Windows> get-command -type cmdlet start-transcript | fl *
HelpUri : http://go.microsoft.com/fwlink/?LinkID=113408
DLL : C:\Windows\assembly\GAC_MSIL\Microsoft.PowerShell.ConsoleHost\1.0.0.0__31bf3856ad364e35\Microsoft
.PowerShell.ConsoleHost.dll
Verb : Start
Noun : Transcript
HelpFile : Microsoft.PowerShell.ConsoleHost.dll-Help.xml
PSSnapIn : Microsoft.PowerShell.Host
ImplementingType : Microsoft.PowerShell.Commands.StartTranscriptCommand
Definition : Start-Transcript [[-Path] <String>] [-Append] [-Force] [-NoClobber] [-Verbose] [-Debug] [-ErrorAc
tion <ActionPreference>] [-WarningAction <ActionPreference>] [-ErrorVariable <String>] [-WarningV
ariable <String>] [-OutVariable <String>] [-OutBuffer <Int32>] [-WhatIf] [-Confirm]
DefaultParameterSet :
OutputType : {}
Name : Start-Transcript
CommandType : Cmdlet
Visibility : Public
ModuleName : Microsoft.PowerShell.Host <------------ HERE IT IS
Module :
Parameters : {[Path, System.Management.Automation.ParameterMetadata], [Append, System.Management.Automation.Pa
rameterMetadata], [Force, System.Management.Automation.ParameterMetadata], [NoClobber, System.Man
agement.Automation.ParameterMetadata]...}
ParameterSets : {[[-Path] <String>] [-Append] [-Force] [-NoClobber] [-Verbose] [-Debug] [-ErrorAction <ActionPref
erence>] [-WarningAction <ActionPreference>] [-ErrorVariable <String>] [-WarningVariable <String>
] [-OutVariable <String>] [-OutBuffer <Int32>] [-WhatIf] [-Confirm]}
get-commandのデフォルトテーブルに表示されないModuleNameプロパティがあります。 (ModuleNameを探す:Microsoft.PowerShell.Host) – user1324792
これはうまくいきます:get-command -typeコマンドレットstart-transcript |モジュール名 – user1324792
を選択します。より簡潔なバージョン: '(Get-Command Start-Transcript).ModuleName' –