AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-439317

Lee Exothermix's questions

Martin Hope
Lee Exothermix
Asked: 2020-08-29 08:50:54 +0800 CST

使用 powershell 获取和添加活动目录域 OU 审计规则

  • 0

我想使用 powershell 编写脚本来显示和编辑 Active Directory 对象的审核规则,而不是通过如下所述的 GUI 操作:从 Active Directory 用户和计算机中,在“查看”菜单中启用“高级功能”,选择“域”左侧窗格中的 Controllers OU” 右键单击​​“Domain Controllers OU”对象并选择“Properties” 选择“Security”选项卡 选择“Advanced”按钮,然后选择“Auditing”选项卡

这是我到目前为止所拥有的。首先获取OU的distinguishedName:

import activedirectory
set-location ad:
dir

将上面 dir 输出中正确的 distinctName 插入 Get-Acl:

$acl = Get-Acl -Path "DC=something,DC=somethingElse"

$acl 对象的 GetSecurityDescriptorSddlForm 方法似乎相关,但不提供人类可读的输出。接下来我尝试了:

$domain = Get-AdDomain -Server "serverName"
$domainSID = $domain.DomainSID
$acl.GetAuditRules(1,1,$domainSID)

但这给出了一个错误:无法将 GetAuditRules 的参数 targetType 与值“...”转换为类型“System.Type”:无法将 System.Security.Principal.SecurityIdentifier 类型的“...”值转换为类型“System.Type”。类型”

GetAuditRules 的文档似乎说它将接受第三个参数的 SecurityIdentifier,这就是我认为我提供 GetAuditRules 方法的内容。 https://docs.microsoft.com/en-us/dotnet/api/system.security.accesscontrol.commonobjectsecurity.getauditrules?view=dotnet-plat-ext-3.1

另外,这里的帖子似乎相关,但我不明白如何选择正确的构造方法来创建 ActiveDirectoryAuditRule,以及如何收集所需的参数,例如 GUID https://social.technet.microsoft.com/Forums /en-US/70881826-6189-48c0-8ee7-0d79aa18f085/powershell-to-set-audit-flags-on-ou?forum=ITCG

任何帮助表示赞赏。谢谢!

powershell active-directory organizational-unit
  • 1 个回答
  • 537 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve