Tuesday, March 6, 2012

Supprimer un profil local

Force sharepoint à le recreer :

#Get Site Collection
$SPsite = Get-SPSite "http://monportail"
#$OpenWeb = $SPSite.OpenWeb($SiteCollection)
$user = "Domaine\user"

$OpenWeb = $SPSite.RootWeb

$User = $OpenWeb.SiteUsers | Where {$_.LoginName -eq $User}
IF ($user)
{ $OpenWeb.SiteUsers.Remove($User)
Write-Host "$User Supprimé: $Site/$SiteCollection" }
else
{Write-Host "Non trouvé"}
$OpenWeb.Dispose()
$SPSite.Dispose()

No comments: