-
Notifications
You must be signed in to change notification settings - Fork 0
/
patch-my-pc.ps1
65 lines (56 loc) · 2.86 KB
/
patch-my-pc.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
64
65
# Thanks to haavarstein for the idea
Clear-Host
Write-Verbose "Setting Arguments" -Verbose
$ProgressPreference = 'SilentlyContinue'
$Path = "C:\Windows\Temp"
$Template = "$Path\AppV_Template.appvt"
$TemplateURL = "https://raw.githubusercontent.com/haavarstein/Applications/master/AppV_Template.appvt"
$XML = "$Path\Applications.xml"
$XMLURL = "https://raw.githubusercontent.com/haavarstein/Applications/master/Applications.xml"
$PatchMyPC = "$Path\Definitions.xml"
$PatchMyPCURL = "https://patchmypc.com/freeupdater/definitions/definitions.xml"
# Set Timeout
[System.Net.ServicePointManager]::MaxServicePointIdleTime = 5000000
Write-Verbose "Installing Required PowerShell Modules" -Verbose
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
if (!(Test-Path -Path "C:\Program Files\PackageManagement\ProviderAssemblies\nuget")) { Install-PackageProvider -Name 'Nuget' -ForceBootstrap -IncludeDependencies }
if (!(Get-Module -ListAvailable -Name Evergreen)) { Install-Module Evergreen -Force | Import-Module Evergreen }
#if (!(Get-Module -ListAvailable -Name IntuneWin32App)) {Install-Module IntuneWin32App -Force | Import-Module IntuneWin32App}
#Install-Module powershell-yaml
If (!(Test-Path -Path $Path)) {New-Item -ItemType directory -Path $Path | Out-Null}
Invoke-WebRequest -UseBasicParsing -Uri $TemplateURL -OutFile $Template
Invoke-WebRequest -UseBasicParsing -Uri $XMLURL -OutFile $XML
Invoke-WebRequest -UseBasicParsing -Uri $PatchMyPCURL -OutFile $PatchMyPC
$MyConfigFileloc = ("$XML")
[xml]$MyConfigFile = (Get-Content $MyConfigFileLoc)
$MyDefinitionFileloc = ("$PathMyPC")
[xml]$MyDefinitionFile = (Get-Content $Path\Definitions.xml)
foreach ($App in $MyConfigFile.Applications.ChildNodes)
{
#Connect-MSIntuneGraph -TenantID $TentantID | Out-Null
$Product = $App.Product
write-verbose "Product: $Product " -verbose
$Vendor = $App.Vendor
write-verbose "Vendor: $Vendor" -verbose
$Architecture = $App.Architecture
write-verbose "Architecture: $Architecture" -verbose
$DisplayName = $App.DisplayName
write-verbose "DisplayName: $DisplayName" -verbose
$PackageName = "$Product"
write-verbose "PackageName: $PackageName " -verbose
$Evergreen = $App.Evergreen
write-verbose "Evergreen: $Evergreen" -verbose
$Version = $MyDefinitionFile.Data.ARPData.$("$Product" + "Ver")
write-verbose "Version: $Version" -verbose
$URL = $MyDefinitionFile.Data.ARPData.$("$Product" + "Download")
write-verbose "URL: $URL " -verbose
$InstallerType = $App.Installer
write-verbose "InstallerType: $InstallerType " -verbose
$UnattendedArgs = $App.Install
write-verbose "UnattendedArgs: $UnattendedArgs" -verbose
$UnattendedArgs = $UnattendedArgs.Replace("/i ","")
write-verbose "UnattendedArgs without /i: $UnattendedArgs " -verbose
$LogApp = "${env:SystemRoot}" + "\Temp\$Product $Version.log"
write-verbose "LogApp: $LogApp" -verbose
write-output "-----------------------------------------------------------------"
}