windows - PowerShell 将 AD objectGUID 复制到 ms-ds-consistencyguid

标签 windows powershell azure active-directory guid

我正在尝试解决一个 PowerShell 问题,事实证明该问题比我最初想象的要复杂。当尝试将每个域用户的 objectGUID 复制到相同用户 ms-ds-consistencyguid 时,值不匹配。有人可以帮忙吗?

我尝试了下面这个粗略的方法,但 GUID 不匹配:

$SGSADUser=get-aduser -filter {samaccountname -eq 'Test10_User'} -Properties objectguid,samaccountname,ms-ds-consistencyguid | Select Samaccountname,Objectguid,ms-ds-consistencyguid

[guid]$SGSADMSDSConsistencyguid = ($SGSADUser.objectguid).ToString()

$SGSADbase64 = [System.Convert]::ToBase64String($SGSADMSDSConsistencyguid.ToByteArray())

set-aduser -Identity 'Test10_User' -replace @{'ms-ds-consistencyguid' = $SGSADbase64} 

ObjectGUID
ms-ds-ConsistencyGuid

最佳答案

我刚刚完成了这个操作,当您转换为 Base 64 时,值会发生变化。

尝试

set-aduser -Identity 'Test10_User' -replace @{'ms-ds-consistencyguid' = $SGSADMSDSConsistencyguid}

当我检查时,结果是正确的值。

谢谢,蒂姆。

关于windows - PowerShell 将 AD objectGUID 复制到 ms-ds-consistencyguid,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40544117/

相关文章:

windows - 当系统上没有可执行文件时如何卸载 Windows 服务?

c++ - 多个显示器上的 SetConsoleWindowInfo

Azure 函数 : Unable to load DLL 'sni.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)

azure - 如何在没有管理 API 的情况下在 Azure 中查找当前 guest 操作系统版本?

powershell - 为什么我无法从 PowerShell.Streams.Error.add_DataAdded 写入错误?

Azure 服务总线主题订阅并发

python - vscode "no refactorings available"for python

windows - 跨平台的 OpenCV 视频

powershell - 如何在自定义 cmdlet 中正确使用 -verbose 和 -debug 参数

powershell - 无法通过 Powershell 在 ARM 模板中传递数组类型参数