我需要一个脚本来验证是否有多个用户是AD组列表的成员,如果有,请删除它们。我有这样的东西:
func documentInteractionControllerViewControllerForPreview(_ controller: UIDocumentInteractionController) -> UIViewController {
return self.navigationController ?? self
}
但是出现以下错误:
Remove-ADGroupMember : Cannot validate argument on parameter 'Identity'. The argument is null. Provide a valid value for the argument, and then try running the command again. At line:12 char:44 + Remove-ADGroupMember -Identity $group.Name -Members $user.SamAccount ... + ~~~~~~~~~~~ + CategoryInfo : InvalidData: (:) [Remove-ADGroupMember], ParameterBindingValidationException + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.ActiveDirectory.Management.Commands.RemoveADGroupMember
答案 0 :(得分:1)
猜测您正在改编一些预先存在的代码,因为该行中的属性未在代码中定义:
Remove-ADGroupMember -Identity $group.Name -Members $user.SamAccountName -Confirm:$false
易于修复,只需将$group.Name
更改为$group
,还需要将$user.SamAccountName
更改为$user
Remove-ADGroupMember -Identity $group -Members $user -Confirm:$false