如何组织powershell class定义
How to organize powershell class definition
我 运行 在 ise
中执行以下代码片段时遇到问题,方法是全选并单击 运行:
Import-Module ActiveDirectory
class ADUtil
{
[Microsoft.ActiveDirectory.Management.ADGroup] $Group
}
类型 [Microsoft.ActiveDirectory.Management.ADGroup] 未知。如果我首先显式执行 Import-Module ActiveDirectory
,那么我可以 运行 class 定义而不会出现任何错误。
我 运行 在 ise
中执行以下代码片段时遇到问题,方法是全选并单击 运行:
Import-Module ActiveDirectory
class ADUtil
{
[Microsoft.ActiveDirectory.Management.ADGroup] $Group
}
类型 [Microsoft.ActiveDirectory.Management.ADGroup] 未知。如果我首先显式执行 Import-Module ActiveDirectory
,那么我可以 运行 class 定义而不会出现任何错误。