我有下面的代码行,它应该得到以@符号开头的所有Active Directory组,然后从这些组中删除一个用户;
Get-ADGroup -Filter 'name -like "@*"' | Remove-ADGroup -identity [USERID]Get-ADGroup工作得很好,它成功地抓住了以@开头的所有组,但是当我通过管道删除-ADGroup时,我得到了每个@组的以下错误;
Remove-ADGroup : The input object cannot be bound to any parameters for the command either because the command does not take pipeline input or the input and its properties do not match any of the parameters that take pipeline input.
At line:1 char:41
+ Get-ADGroup -Filter 'name -like "@*"' | Remove-ADGroup -identity [USERID]
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: CN=@Workplace,O...ife,DC=co,DC=uk:PSObject) [Remove-ADGroup], ParameterBindingException
+ FullyQualifiedErrorId : InputObjectNotBound,Microsoft.ActiveDirectory.Management.Commands.RemoveADGroup我搞不懂为什么管子坏了。
发布于 2016-05-16 16:29:36
Remove-ADGroup将完全删除组--这绝对不是您想要的。
使用Remove-ADGroupMember代替:
Get-ADGroup -Filter 'name -like "@*"' | Remove-ADGroupMember -Members [USERID]https://stackoverflow.com/questions/37258053
复制相似问题