TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
PowerShell Script
Rajkiran Swain
Aug 25
2015
Code
883
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
Function Get - SPLanguagePacks {
param($Path, $DownloadId)
if
(!(Test - Path $Path)) {
New - Item $Path - ItemType
"Directory"
}
cd $Path
$request = Invoke - WebRequest http:
//www.microsoft.com/en-gb/download/details.aspx?id=$DownloadId
[xml] $options = $request.AllElements | where -
object
{
$_.name - eq
"newlocale"
} | select -
object
- ExpandProperty OuterHtml
$options.select.option | Foreach -
object
{
$path = $filePath
$text = $_.innerText
$code = $_.value
write - host
"Downloading language pack $text "
$fileRequest = Invoke - WebRequest
"http://www.microsoft.com/$value/download/confirmation.aspx?id=$DownloadId"
$fileLink = $fileRequest.Links | where -
object
{
$_.href - like
"*.exe"
- or $_.href - like
"*.img"
} | Select - Object - First 1 - ExpandProperty href
New - Item - ItemType
"Directory"
- Name $text |
out
-
null
Start - BitsTransfer $fileLink - Destination.\$($text) - Asynchronous - DisplayName
"$text Transfer"
| Out - Null
}
$transfers = Get - BitsTransfer
write - host
"Downloading..."
- NoNewline
while
(($transfers | where -
object
{
$_.JobState - eq
"Connecting"
- or $_.JobState - eq
"Transferring"
}).Count - gt 0) {
write - host
"."
- NoNewline
sleep 5
}
$transfers | Where - Object {
$_.JobState - eq
"Transferred"
} | Complete - BitsTransfer
}
Sharepoint