使用 PowerShell ADSI 提供程序将组添加到组
创建新组后,我尝试了以下操作:
$adminGroup = [ADSI]"WinNT://./Administrators"
$group =[ADSI]"WinNT://./Test1"
#$adminGroup.Add($group) - This does not work
知道缺少什么吗?
I tried the following after creating the new group:
$adminGroup = [ADSI]"WinNT://./Administrators"
$group =[ADSI]"WinNT://./Test1"
#$adminGroup.Add($group) - This does not work
Any idea what is missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不知道为什么它不能与句点一起使用,但如果您使用 computername 变量,它就可以正常工作
Not sure why it isn't working with the period, but it works fine if you use the computername variable
你真的在本地机器上添加东西吗?否则,我强烈建议使用 LDAP 提供程序而不是 WinNT:// - 这实际上只是为了本地计算机处理和向后兼容性而提供。
如果您必须使用 WinNT:// - 如果我没记错的话,通常您必须提供您正在处理的对象的类型。不确定这是否也适用于 PowerShell cmdlet - 但您可以随时尝试!
我依稀记得尝试使用 WinNT 提供程序嵌套组时存在问题。我知道 LDAP:// 可以毫无问题地做到这一点 - 不确定它是否曾经在 WinNT:// 上工作过......(已经太长了)。
马克
Are you really adding stuff on your local machine?? Otherwise, I'd strongly recommend using the LDAP provider instead of WinNT:// - that's provided just for local machine handling, and backward compatibility, really.
If you must use WinNT:// - if I remember correctly, typically you had to provide the type of object you were dealing with. Not sure if that translates to the PowerShell cmdlets as well - but you could always try!
And I vaguely remember there were issues with trying to nest groups with the WinNT provider, I think. I know LDAP:// can do it no problems - not sure if it ever worked on WinNT:// though.... (it's been too long).
Marc