用Powershell脚本从部门中删除用户遇到困难
我有一个在部门中的用户,我可以用以下
$UserDepartment = Get-ADUser $UserName -Property Department | Select-Object Department
Write-Host $UserDepartment
返回的行拉部门: @{department = sales}
我需要一种方法,在不删除用户的同时将用户带出部门,并且不确定如何处理
I have a user that is in a department that I can pull the department with the following line
$UserDepartment = Get-ADUser $UserName -Property Department | Select-Object Department
Write-Host $UserDepartment
which returns:
@{Department=SALES}
I need a way to take the user out of the department while not deleting the user and wasn't sure how to go about it
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您想清除用户的属性,您应该使用
-Clear
参数。请参阅参数此 cmdlet 的 部分。
If you want to clear a user's attribute you should use the
-Clear
parameter.See the Parameters section for this cmdlet.
您可以做一些事情,
例如要清除部门的属性
,可以查看 powerShell文档
You could do something like
If you wish to mearly clear the department property
You can check out the powershell documentation for it here