小编pha*_*rus的帖子

有没有办法以编程方式确定 Windows 计算机是否作为 SYSTEM 加入 AAD?

我希望能够通过脚本确定给定的 Windows 工作站是加入 AAD、混合 AD 还是加入本地 AD。

我想从我正在使用的 RMM 运行此脚本,这样我就可以将这些结果存储在 RMM 中,并能够轻松地将计算机分为这三个类别(加上一个用于未加入任何类型域的工作站的类别)。

我使用的 RMM 以 NT AUTHORITY\SYSTEM 身份运行 powershell 脚本。

获取此信息的通常推荐方法是运行命令

dsregcmd /status
Run Code Online (Sandbox Code Playgroud)

然而,根据微软的文档

dsregcmd /status 实用程序必须作为域用户帐户运行。

我在自己的测试中验证了在 Powershell 中运行 dsregcmd /status 作为 NT AUTHORITY\SYSTEM 返回错误

dsregcmd : The term 'dsregcmd' is not recognized as the name of a cmdlet, function, script file, or operable program.
Run Code Online (Sandbox Code Playgroud)

在 cmd 中运行该命令会返回类似的错误。

当我尝试指定 dsregcmd.exe 的完整路径时,错误是相同的。

有没有办法让这个命令在以 SYSTEM 身份运行时起作用?或者,是否有另一种方法可以确定工作站在以 SYSTEM 身份运行时是否已加入 AAD?

windows powershell entra-id

6
推荐指数
1
解决办法
3068
查看次数

标签 统计

entra-id ×1

powershell ×1

windows ×1