SSP
Récupérez les photos des utilisateurs de votre SSP via powershell
Bonjour,
Je poste tel que un script Powershell permettant de télécharger les photos de tous vos utilisateurs du SSP.
#TBUI from http://www.readmespot.com/question/f/156835/list-all-user-profile-properties-with-powershell---powershell-query
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server")
[void][System.Reflection.Assembly]::LoadWithPartialName("Microsoft.Office.Server.UserProfiles")
Function global:Get-UserProfiles($SSPName)
{
$ServerContext = [Microsoft.Office.Server.ServerContext]::GetContext($SSPName);
$UPManager = new-object Microsoft.Office.Server.UserProfiles.UserProfileManager($ServerContext);
return $UPManager.GetEnumerator();
}
function GetAllProfilesImages(){
#give SSP name
$profiles = Get-UserProfiles("SSP1");
$profiles | ForEach-Object {
$PreferredName = $_.Item("PreferredName");
$AccountName = $_.Item("AccountName");
$PersonalSpace = $_.Item("PersonalSpace");
$PictureURL = $_.Item("PictureURL");
if ($PictureURL -ne ""){
$clnt = new-object System.Net.WebClient;
$clnt.UseDefaultCredentials = $true
$url = $PictureURL.ToString();
$file = 'images\' ;
$file +=$PreferredName;
$file += ".jpg";
Write-Host "downloading $url in $file";
$clnt.DownloadFile($url,$file)
}
}
}
GetAllProfilesImages