-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathziploader.ps1
64 lines (39 loc) · 2.45 KB
/
ziploader.ps1
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
52
53
54
55
56
57
58
59
60
61
62
63
<#
VORLAGE.ps1
.DESCRIPTION
Script-Vorlage
https://github.com/thelamescriptkiddiemax/powershell
#>
#--- Variablen ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$downloadlink = "http://media.steampowered.com/installer/steamcmd.zip"
$zielpfad = "C:\Users\max\Desktop\test"
#--- Vorbereitung -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
$stringhost = [System.String]::Concat("[ ", $env:UserName, " @ ", $env:computername, " @ ", ((Get-WmiObject Win32_ComputerSystem).Domain), " ", (Get-CimInstance Win32_OperatingSystem | Select-Object Caption), ": ",
((Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\" -Name ReleaseID).ReleaseId), " ] ", (Get-Date -Format "dd/MM/yyyy HH:mm:ss"), "`n", "[ ", $MyInvocation.MyCommand.Name, " ]", "`n","`n")
$stringhost = $stringhost.replace("{Caption=Microsoft"," ").replace("}", " ")
$zipname = "temp"
$zipnameF = [System.String]::Concat($zipname, ".zip")
$downloadzip = ("$zielordner\$zipnameF")
$ziel = ("$zielpfad\$zielordner")
$jobnamezip = "zipextract"
#--- Verarbeitung -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
#Clear-Host
Write-Host $stringhost -ForegroundColor Magenta
Write-Host " Beginne Download..."
Start-Sleep -Seconds 2
Invoke-WebRequest -Uri $downloadlink -OutFile $downloadzip
#Clear-Host
Write-Host $stringhost -ForegroundColor Magenta
Write-Host " ...Download abgeschlossen. Entpacke..."
Start-Sleep -Seconds 2
Start-Job -Name "zipextract" -scriptblock
{
Param($downloadzip, $ziel)
foreach ($d in $downloadzip){
Expand-Archive -Path $d.FullName -DestinationPath $ziel\$($d.BaseName) -Verbose
}
}
Wait-Job -Name "zipextract"
#Remove-Item -Path $steamCMDdir\*.zip
#------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
stop-process -Id $PID # Shell schliessen