-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSuMo.ps1
More file actions
51 lines (48 loc) · 1.99 KB
/
SuMo.ps1
File metadata and controls
51 lines (48 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
Clear-host
Add-Type -AssemblyName "System.IO.Compression.FileSystem"
$Software = "SuMo"
$DistribPath = '.\'
$FileName = 'sumo.zip'
#$URLPage = 'http://www.kcsoftwares.com/?download'
$DownLoadURL = "http://www.kcsoftwares.com/files/sumo.zip"
#$DownLoadURL = "http://www.kcsoftwares.com/files/sumo.exe"
#$DownLoadURL = "http://www.kcsoftwares.com/files/sumo_lite.exe"
#$DownLoadURL = "http://www.kcsoftwares.com/files/sumo.7z"
Write-Host "-===========-" -ForegroundColor Green
Write-Host "Product: $Software"
if (Test-Path "$DistribPath\$FileName")
{
if (!(Test-Path "$DistribPath\temp\$FileName"))
{
New-Item -Path $DistribPath\temp -ItemType "directory" -ErrorAction Silentlycontinue |out-null
write-host
}
$destination = "$DistribPath\temp\$FileName"
write-host "Ñêà÷èâàåì ôàéë ñ ñåðâåðà"
$wc = New-Object System.Net.WebClient
$wc.DownloadFile($DownLoadURL, $destination)
$hash1 = Get-FileHash $DistribPath\$FileName -Algorithm MD5 |select -exp hash
$hash2 = Get-FileHash $DistribPath\temp\$FileName -Algorithm MD5 |select -exp hash
if ($hash1 -eq $hash2)
{
write-host "Ïîäòâåðæäàþ, ÷òî ôàéë íà ñåðâåðå íå îáíîâèëñÿ"
del $DistribPath\temp -recurse
}
else
{
Write-warning "Ôàéë íà ñåðâåðå îáíîâèëñÿ"
try
{
Move-Item $DistribPath\temp\$FileName -Destination $DistribPath -Force
Start-Process "$env:ProgramFiles\7-Zip\7z.exe" -ArgumentList "x -r $DistribPath\temp\$FileName -od:\WPI\sumo" -wait
del $DistribPath\temp
}
catch
{
Write-Host "Îøèáêà ðàñïàêîâêè èëè óäàëåíèÿ"
}
Write-Host "Ðàñïàêîâàëè zip àðõèâ"
pause
}
}
Write-Host "-===========-" -ForegroundColor Green