Wednesday, February 18, 2015

PowerShell - Download Images from Web

I had a requirement where I have to export user profile images from MySite 2013 and I end up writing following PowerShell script:

[Reflection.Assembly]::LoadFile( `
'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Web.dll')`
  | out-null 

$FileName = "C:\Temp\ImagesURL.txt";
$Loc = "C:\Temp\Images\"
$ImageName = ""

$wc = New-Object System.Net.WebClient

$content = Get-Content $FileName
foreach ($line in $content)
{
    $Image = $Loc + $line.Substring($line.LastIndexOf("/") + 1)
    $url = $line
    
    Write-Host $url
    Write-Host $Image
    
    $wc.DownloadFile($url, $Image)
    
}

write-host "Finished successfully."

Microsoft Graph vs Office Graph

Microsoft introduced Office Graph a couple of months back which uses machine learning techniques to connect people to the relevant content,...