Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
PowerShell Script
WhatsApp
Rajkiran Swain
Aug 25
2015
1
k
0
0
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
Up Next
PowerShell Script