我收到错误“无法删除用户'me@user.com'。” Azure和Office 365中的错误“并非所有选定的用户都被删除了一些用户此时无法删除。相关ID:”。
我已经使用几个O365技术运行以下内容,它不会删除。它不在任何共享资源,联系人列表,dlist等中。
PS C:\Users\owner> set-executionpolicy unrestricted
Execution Policy Change
The execution policy helps protect you from scripts that you do not trust. Changing the execution policy might expose
you to the security risks described in the about_Execution_Policies help topic. Do you want to change the execution
policy?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):
PS C:\Users\owner> $Cred = Get-Credential
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $Cred -Authentication Basic –AllowRedirection
Import-PSSession $Session
PS C:\Users\owner> Remove-MsolUser -UserPrincipalName me@user.com
Confirm
Continue with this operation?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):
Remove-MsolUser : Unable to complete this action. Try again later.
At line:1 char:16
+ Remove-MsolUser <<<< -UserPrincipalName me@user.com
+ CategoryInfo : OperationStopped: (:) [Remove-MsolUser], MicrosoftOnlineException
+ FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.InternalServiceException,Microsoft.Online.Adm
inistration.Automation.RemoveUser
PS C:\Users\owner> remove-msoldomain -domainname user.com -force
Remove-MsolDomain : Unable to remove this domain. Use Get-MsolUser -DomainName <domain name> to retrieve a list of obj
ects that are blocking removal.
At line:1 char:18
+ remove-msoldomain <<<< -domainname user.com -force
+ CategoryInfo : OperationStopped: (:) [Remove-MsolDomain], MicrosoftOnlineException
+ FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.DomainNotEmptyException,Microsoft.Online.Admi
nistration.Automation.RemoveDomain
PS C:\Users\owner> get-msoluser -domainname user.com
UserPrincipalName DisplayName isLicensed
----------------- ----------- ----------
me@user.com User A. Name False
PS C:\Users\owner> remove-msoluser -userprincipalname me@user.com
Confirm
Continue with this operation?
[Y] Yes [N] No [S] Suspend [?] Help (default is "Y"):
Remove-MsolUser : Unable to complete this action. Try again later.
At line:1 char:16
+ remove-msoluser <<<< -userprincipalname me@user.com
+ CategoryInfo : OperationStopped: (:) [Remove-MsolUser], MicrosoftOnlineException
+ FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.InternalServiceException,Microsoft.Online.Adm
inistration.Automation.RemoveUser
PS C:\Users\owner> remove-msoluser -userprincipalname me@user.com -force
Remove-MsolUser : Unable to complete this action. Try again later.
At line:1 char:16
+ remove-msoluser <<<< -userprincipalname me@user.com -force
+ CategoryInfo : OperationStopped: (:) [Remove-MsolUser], MicrosoftOnlineException
+ FullyQualifiedErrorId : Microsoft.Online.Administration.Automation.InternalServiceException,Microsoft.Online.Adm
inistration.Automation.RemoveUser
答案 0 :(得分:0)
你可以尝试两件事(按顺序):
Set-MsolUserLicense
将用户的域名更改为其他域名:
$user = Get-MsolUser -UserPrincipalName "user.com"
Set-MsolUserPrincipalName -ObjectId $user.ObjectId -NewUserPrincipalName "me@user.onmicrosoft.com"
首先尝试(1),然后尝试删除。如果它仍然不起作用,请执行(2),然后尝试删除。