Skip to content

Commit b345d72

Browse files
committed
Added function Receive-GoogleChromeEnterpriseMsi.
1 parent 4ccec74 commit b345d72

File tree

2 files changed

+203
-0
lines changed

2 files changed

+203
-0
lines changed
Lines changed: 152 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,152 @@
1+
<#PSScriptInfo
2+
3+
.Version
4+
1.0
5+
.Guid
6+
a56f96f1-27d1-4d1d-85aa-ca206cee7fe5
7+
.Author
8+
Thomas Malkewitz @dotps1
9+
.Tags
10+
Google, Chrome, Msi
11+
.ProjectUri
12+
https://github.com/dotps1/PSFunctions
13+
.ReleaseNotes
14+
Initial Release.
15+
16+
#>
17+
18+
<#
19+
20+
.SYNOPSIS
21+
Gets the Google Chrome for Enterprise msi.
22+
.DESCRIPTION
23+
Gets the Latest version of the Google Chrome for Enterprise msi.
24+
.INPUTS
25+
System.String
26+
.OUTPUTS
27+
System.IO.FileInfo
28+
.PARAMETER Path
29+
System.String
30+
The path to save the msi installer.
31+
.PARAMETER Architecture
32+
System.String
33+
The specified OS Architecture of the installer to get. Defaults to "All" (x64 and x86).
34+
.EXAMPLE
35+
PS C:\> Get-GoogleChromeMsiInstaller
36+
37+
38+
Directory: C:\Users\dotps1\Downloads
39+
40+
41+
Mode LastWriteTime Length Name
42+
---- ------------- ------ ----
43+
-a---- 12/12/2018 4:11 PM 55500800 googlechromestandaloneenterprise.msi
44+
-a---- 12/12/2018 4:11 PM 56463360 googlechromestandaloneenterprise64.msi
45+
.EXAMPLE
46+
PS C:\> Get-GoogleChromeMsiInstaller -Path C:\Temp -Architecture x86
47+
48+
49+
Directory: C:\Users\dotps1\Downloads
50+
51+
52+
Mode LastWriteTime Length Name
53+
---- ------------- ------ ----
54+
-a---- 12/12/2018 4:11 PM 55500800 googlechromestandaloneenterprise.msi
55+
.NOTES
56+
The installer download links are renedered on the google page with javascript,
57+
these links are fetched with an Internet Explorer COM object to cause that javascript to run and expose the links.
58+
.LINK
59+
https://dotps1.github.io
60+
61+
#>
62+
63+
64+
[CmdletBinding(
65+
ConfirmImpact = "High",
66+
SupportsShouldProcess = $true
67+
)]
68+
[OutputType(
69+
[System.IO.FileInfo]
70+
)]
71+
72+
param (
73+
[Parameter(
74+
ValueFromPipeline = $true,
75+
ValueFromPipelineByPropertyName = $true
76+
)]
77+
[String]
78+
$Path = "${env:USERPROFILE}\Downloads",
79+
80+
[Parameter()]
81+
[ValidateSet(
82+
"All", "X86", "X64"
83+
)]
84+
[String]
85+
$Architecture = "All"
86+
)
87+
88+
begin {
89+
if (-not (Test-Path -Path $Path)) {
90+
try {
91+
Out-Null -InputObject (
92+
New-Item -Path $Path -ItemType Directory -ErrorAction Stop
93+
)
94+
} catch {
95+
$PSCmdlet.ThrowTerminatingError(
96+
$_
97+
)
98+
99+
break
100+
}
101+
}
102+
103+
$downloader = New-Object -TypeName System.Net.WebClient
104+
}
105+
106+
process {
107+
if ($Architecture -in @("All", "X86")) {
108+
$downloadUriX86 = 'https://dl.google.com/edgedl/chrome/install/GoogleChromeStandaloneEnterprise.msi'
109+
$msiX86 = Join-path -Path $Path -ChildPath "googlechromestandaloneenterprise.msi"
110+
111+
if (Test-Path -Path $msiX86) {
112+
$shouldProcess = $PSCmdlet.ShouldProcess(
113+
$msiX86, "Overwrite"
114+
)
115+
} else {
116+
$shouldProcess = $true
117+
}
118+
119+
if ($shouldProcess) {
120+
$downloader.DownloadFile(
121+
$downloadUriX86, $msiX86
122+
)
123+
124+
Write-Output -InputObject ( Get-Item -Path $msiX86 )
125+
}
126+
}
127+
128+
if ($Architecture -in @("All", "X64")) {
129+
$downloadUriX64 = 'https://dl.google.com/edgedl/chrome/install/GoogleChromeStandaloneEnterprise64.msi'
130+
$msiX64 = Join-path -Path $Path -ChildPath "googlechromestandaloneenterprise64.msi"
131+
132+
if (Test-Path -Path $msiX64) {
133+
$shouldProcess = $PSCmdlet.ShouldProcess(
134+
$msiX64, "Overwrite"
135+
)
136+
} else {
137+
$shouldProcess = $true
138+
}
139+
140+
if ($shouldProcess) {
141+
$downloader.DownloadFile(
142+
$downloadUriX64, $msiX64
143+
)
144+
145+
Write-Output -InputObject ( Get-Item -Path $msiX64 )
146+
}
147+
}
148+
}
149+
150+
end {
151+
$downloader.Dispose()
152+
}

README.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,28 @@ PS C:\> Get-Credential | Enable-WindowsStore
4646

4747
---
4848

49+
### Expand-SCVirtualMachineOSDisk
50+
Using information from Virtual Machine Manager and CIM, this cmdlet adds space to the virtual machines vhdx file and expands the partion.
51+
52+
```
53+
PS C:\> Expand-SCVirtualMachineOSDisk -Name MyVirtualMachine
54+
55+
Name: MyVirtualMachine
56+
OSDriveLetter: C
57+
OSPartitionPreviousSizeGB: 40
58+
OSPartitionNewSizeGB: 50
59+
60+
61+
PS C:\> "MyVirtualMachine" | Expand-SCVirtualMachineOSDisk -AmmountToAddGB 25
62+
63+
Name: MyVirtualMachine
64+
OSDriveLetter: C:
65+
OSPartitionPreviousSizeGB: 25
66+
OSPartitionNewSizeGB: 50
67+
```
68+
69+
---
70+
4971
### Find-NthIndexOf
5072
Finds the nth index of a char in a string, returns -1 if the char does not exist, or if nth is out of range.
5173

@@ -291,6 +313,35 @@ PolicyStore : ActiveStore
291313

292314
---
293315

316+
### Receive-GoogleChromeEnterpriseMsi.ps1
317+
Gets the Latest version of the Google Chrome for Enterprise msi.
318+
319+
```
320+
PS C:\> Get-GoogleChromeMsiInstaller
321+
322+
323+
Directory: C:\Users\dotps1\Downloads
324+
325+
326+
Mode LastWriteTime Length Name
327+
---- ------------- ------ ----
328+
-a---- 12/12/2018 4:11 PM 55500800 googlechromestandaloneenterprise.msi
329+
-a---- 12/12/2018 4:11 PM 56463360 googlechromestandaloneenterprise64.msi
330+
331+
332+
PS C:\> Get-GoogleChromeMsiInstaller -Path C:\Temp -Architecture x86
333+
334+
335+
Directory: C:\Users\dotps1\Downloads
336+
337+
338+
Mode LastWriteTime Length Name
339+
---- ------------- ------ ----
340+
-a---- 12/12/2018 4:11 PM 55500800 googlechromestandaloneenterprise.msi
341+
```
342+
343+
---
344+
294345
### Set-CsvValue
295346
Sets a value or multiple values in the same row in a comma separated value.
296347

0 commit comments

Comments
 (0)