Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个需要获取全局脚本变量值的 C# Cmdlet。我该怎么做?
我注意到 Runspace 有 SessionStateProxy.GetVariable 方法。我可以从 C# Cmdlet 访问运行空间吗?
谢谢!
如果您正在实现 PSCmdlet,请使用该this变量来访问它,如下所示:
this
this.SessionState.PSVariable.GetValue()