PowerShell Yardımıyla Dosya İndirmek
PowerShell yardımıyla yapamayacağımız işlem yok gibi, mâlum içeriğinde doğrudan kod yazabiliyoruz. Bu noktada işe yarar bir scripti daha paylaşmak istiyorum. Bunu dilerseniz bir fonksiyon haline getirebilir, belli aralıklar ile çalışacak şekilde zamanlayabilir ve sürekli hale getirebilirsiniz.
1 2 3 4 5 6 7 8 9 10 |
$siteurl = "http://yoursite" $sourcefile = "SharedDocuments/Book1.xlsx" $destinationfile = "C:\Temp\Book1.xlsx" $web = Get-SPWeb $siteurl $file = $web.GetFile($sourcefile) $filebytes = $file.OpenBinary() $filestream = New-Object System.IO.FileStream($destinationfile, "Create") $binarywriter = New-Object System.IO.BinaryWriter($filestream) $binarywriter.write($filebytes) $binarywriter.Close() |
No Comments