This script will set a default picture for the PictureUrl in a list where all user information are stored .If users don't specify a picture, the default picture will be used ..
This script contains one advanced functions Set-OSCSPUserPhoto, you can use this script in the following ways:
Method 1:
Method 2:
$File = $PhotosFolder.Files.Add($FullPath, $Picture.OpenRead(), $true)
$ImagePath = $Web.Url + "/" + $File.Url
$profiles =$profileManager.GetEnumerator()
Foreach( $up in $profiles )
{
If(($up["PictureURL"].Value -eq "") -or ($up["PictureURL"].Value -eq $null) )
{
Write-host "Set picture for "$up.displayname
#Get user profile and change the Picture URL value
$up["PictureURL"].Value = $ImagePath
$up.Commit()
}
Else
{
$DisPlayName = $up.DisplayName
Write-warning "$DisPlayName already has the picture."
}
}
$File = $PhotosFolder.Files.Add($FullPath, $Picture.OpenRead(), $true) $ImagePath = $Web.Url + "/" + $File.Url $profiles =$profileManager.GetEnumerator() Foreach( $up in $profiles ) { If(($up["PictureURL"].Value -eq "") -or ($up["PictureURL"].Value -eq $null) ) { Write-host "Set picture for "$up.displayname #Get user profile and change the Picture URL value $up["PictureURL"].Value = $ImagePath $up.Commit() } Else { $DisPlayName = $up.DisplayName Write-warning "$DisPlayName already has the picture."}}

