Powershell "ResumeState" 它的作用

Powershell "ResumeState" what it does

我无法理解我正在使用的一段 PowerShell 脚本:

import-module "C:\Program Files\Microsoft Azure AD Sync\Bin\ADSync\Microsoft.IdentityManagement.PowerShell.Cmdlet.dll"

$connector = "\SERVERNAME\root\MicrosoftIdentityIntegrationServer:MIIS_ManagementAgent.Name=\"contoso.com\""
$profile = "full import"
$resumeStatus = $connector.ResumeState($profile)

最后一行是什么?我没有在任何地方声明 ResumeState 并且 google 没有显示任何结果作为关键字或 PowerShell 函数

读取 WMI 名字字符串的方法如下:

\SERVERNAME\root\MicrosoftIdentityIntegrationServer:MIIS_ManagementAgent.Name=\"contoso.com\"

这意味着我们正在 SERVERNAME 上的 root\MicrosoftIdentityIntegrationServer WMI 命名空间中查找名称为 contoso.com.[=19 的 MIIS_ManagementAgent class 实例=]

现在您知道了 WMI class 名称 (MIIS_ManagementAgent),您可以搜索说明该名称的文档 class:

https://www.google.com/search?&q=MIIS_ManagementAgent

第一个结果是文档:

https://msdn.microsoft.com/en-us/library/windows/desktop/ms697764.aspx

文档列出了 class 的方法。请注意,没有列出 ResumeState 方法。

根据这一点研究,我认为代码已损坏,因为 class 没有这样的方法。