如果您想找出加载了哪些模块,请执行Get-Module
. 但不要将 PowerShell 模块与 ProcessModule(一个 .dll)混淆。如果进程模块是二进制 PowerShell 模块或 PSSnapin 的一部分,则进程模块可能与 PowerShell 相关。OTOH PowerShell 模块可以(并且通常是)只是一个 PSM1 文件 - 根本没有 dll。
AppDomain 是一个非常广泛的 .NET 概念,适用于所有 .NET 进程。PowerShell 具有运行空间,它是运行管道的环境,您的会话状态被管理(全局变量、提供程序状态等)。通常每个 PowerShell 进程都有一个运行空间,但在 PowerShell_ISE 的情况下,它可以有多个运行空间(每个 PowerShell 选项卡一个)。您可以通过以下方式看到这一点:
PS> $ExecutionContext.Host.Runspace
Events : System.Management.Automation.PSLocalEventManager
ThreadOptions : ReuseThread
JobManager : System.Management.Automation.JobManager
RunspaceConfiguration :
InitialSessionState : System.Management.Automation.Runspaces.InitialSessionState
Version : 3.0
RunspaceStateInfo : Opened
RunspaceAvailability : Busy
ConnectionInfo :
OriginalConnectionInfo :
LanguageMode : FullLanguage
ApartmentState : STA
InstanceId : b80ae2aa-a70b-43b2-a63f-def6c92fd032
SessionStateProxy : System.Management.Automation.Runspaces.SessionStateProxy
Debugger : System.Management.Automation.Debugger
请注意,在 PowerShell 提示符中,InstanceId 通常是相同的。例外是在不同运行空间(通常是不同的进程)中运行的作业、事件处理程序和工作流。
PSSession 是一种有点不同的野兽,用于指定与远程计算机的持久远程会话。