Cleare userprofile info

$Site = Get-SPSite http://wtcsps99:27841 $ServiceContext = Get-SPServiceContext($Site) $ProfileManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServiceContext) $Profiles = $ProfileManager.GetEnumerator()  

$AccountName = $profile[[Microsoft.Office.Server.UserProfiles.PropertyConstants]::AccountName].Value  Foreach($oUser in $Profiles){

 $ProfileManager.RemoveUserProfile($oUser.item("AccountName")); }

$UPA = Get-SPServiceApplication | ? {$_.typeName -like '*User Profile*'} $UPA.NetBIOSDomainNamesEnabled $UPA.NetBIOSDomainNamesEnabled = $true $UPA.Update() $UPA = Get-SPServiceApplication | ? {$_.typeName -like '*User Profile*'} $UPA.NetBIOSDomainNamesEnabled

or

you can remove the user profile application and delete the data ,readd the application

原文地址:https://www.cnblogs.com/hqbird/p/3666619.html