Skip to content

Commit 50af330

Browse files
Use Chrome as the public reference example (replaces NinjaOne)
- Swap .EXAMPLE blocks in Build-IntuneAppBuilder.ps1 from NinjaOne to Chrome - Add Examples/Chrome/ with a complete reference package: install.ps1, uninstall.ps1, detect.ps1, README.md - Chrome chosen because it's ubiquitous and has well-known MSI + detection patterns. NinjaOne and other client-specific packages live in private client-script repositories. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent faacab5 commit 50af330

5 files changed

Lines changed: 113 additions & 2 deletions

File tree

Intune/Build-IntuneAppBuilder.ps1

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,16 @@
2929
Useful when EDR (e.g., FortiEDR) blocks PowerShell web requests.
3030
3131
.EXAMPLE
32-
.\Build-IntuneAppBuilder.ps1 -AppName "NinjaOne" -Build
32+
.\Build-IntuneAppBuilder.ps1 -AppName "Chrome" -Build
3333
3434
.EXAMPLE
35-
.\Build-IntuneAppBuilder.ps1 -AppName "NinjaOne" -UseCurl -Build
35+
.\Build-IntuneAppBuilder.ps1 -AppName "Chrome" -UseCurl -Build
3636
3737
.NOTES
3838
Stub scripts are templates only. Edit install.ps1, uninstall.ps1, and detect.ps1
3939
before running -Build for a real deployment.
40+
41+
See Examples\Chrome\ for a complete reference package.
4042
#>
4143
[CmdletBinding()]
4244
param(

Intune/Examples/Chrome/README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Example: Google Chrome Enterprise (Intune Win32 App)
2+
3+
Reference package showing a complete Win32 app built with `Build-IntuneAppBuilder.ps1`.
4+
5+
## Files
6+
7+
| File | Purpose |
8+
|------|---------|
9+
| `install.ps1` | Silent install via msiexec, logs to IME log dir |
10+
| `uninstall.ps1` | Uninstall by product code |
11+
| `detect.ps1` | Version-based detection on chrome.exe |
12+
13+
## Build
14+
15+
1. Download `googlechromestandaloneenterprise64.msi` from https://chromeenterprise.google/download/
16+
2. Place it alongside `install.ps1` (same `Source\` folder)
17+
3. From the package root:
18+
```powershell
19+
.\Build-IntuneAppBuilder.ps1 -AppName Chrome -Build
20+
```
21+
4. Upload `Output\install.intunewin` to Intune.
22+
23+
## Intune app settings
24+
25+
- **Install command:** `powershell.exe -ExecutionPolicy Bypass -File install.ps1`
26+
- **Uninstall command:** `powershell.exe -ExecutionPolicy Bypass -File uninstall.ps1`
27+
- **Install behavior:** System
28+
- **Detection rule:** Custom script → upload `detect.ps1`, run as 32-bit: No
29+
30+
## Notes
31+
32+
- Replace `{CHROME-PRODUCT-CODE-GUID}` in `uninstall.ps1` with the actual product code of the MSI you packaged.
33+
- `detect.ps1` uses version >= 120. Update `$minVersion` to gate on a specific baseline.

Intune/Examples/Chrome/detect.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# detect.ps1 - Google Chrome detection for Intune Win32 app.
2+
# Intune rule: exit 0 + STDOUT = installed; exit 0 + no output = not installed.
3+
#
4+
# Detection strategy: version check against chrome.exe. Change $minVersion to
5+
# whatever minimum you want the Win32 app to treat as "installed".
6+
7+
$minVersion = [Version]'120.0.0.0'
8+
$chromePaths = @(
9+
"$env:ProgramFiles\Google\Chrome\Application\chrome.exe",
10+
"${env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe"
11+
)
12+
13+
foreach ($path in $chromePaths) {
14+
if (Test-Path $path) {
15+
$version = [Version](Get-Item $path).VersionInfo.FileVersion
16+
if ($version -ge $minVersion) {
17+
Write-Output "Chrome $version detected at $path"
18+
exit 0
19+
}
20+
}
21+
}
22+
23+
exit 0

Intune/Examples/Chrome/install.ps1

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# install.ps1 - Google Chrome Enterprise install (Intune Win32 app)
2+
# Runs as SYSTEM under Intune Management Extension.
3+
4+
$ErrorActionPreference = 'Stop'
5+
$log = "$env:ProgramData\Microsoft\IntuneManagementExtension\Logs\Chrome-install.log"
6+
Start-Transcript -Path $log -Append
7+
8+
try {
9+
$msi = Join-Path $PSScriptRoot "googlechromestandaloneenterprise64.msi"
10+
if (-not (Test-Path $msi)) { throw "MSI not found: $msi" }
11+
12+
$args = @('/i', "`"$msi`"", '/qn', '/norestart', 'REBOOT=ReallySuppress')
13+
$proc = Start-Process -FilePath msiexec.exe -ArgumentList $args -Wait -PassThru
14+
15+
if ($proc.ExitCode -ne 0 -and $proc.ExitCode -ne 3010) {
16+
throw "msiexec failed with exit code $($proc.ExitCode)"
17+
}
18+
19+
Write-Host "Chrome install complete (exit $($proc.ExitCode))"
20+
exit 0
21+
} catch {
22+
Write-Error $_
23+
exit 1
24+
} finally {
25+
Stop-Transcript
26+
}
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
# uninstall.ps1 - Google Chrome Enterprise uninstall (Intune Win32 app)
2+
3+
$ErrorActionPreference = 'Stop'
4+
$log = "$env:ProgramData\Microsoft\IntuneManagementExtension\Logs\Chrome-uninstall.log"
5+
Start-Transcript -Path $log -Append
6+
7+
try {
8+
# Product code for Google Chrome Enterprise x64 (stable channel).
9+
# Verify against target MSI version before trusting in production:
10+
# Get-Package | Where-Object Name -like 'Google Chrome*' | Select-Object -ExpandProperty PackageFilename
11+
$productCode = '{CHROME-PRODUCT-CODE-GUID}'
12+
13+
$args = @('/x', $productCode, '/qn', '/norestart')
14+
$proc = Start-Process -FilePath msiexec.exe -ArgumentList $args -Wait -PassThru
15+
16+
if ($proc.ExitCode -ne 0 -and $proc.ExitCode -ne 3010 -and $proc.ExitCode -ne 1605) {
17+
throw "msiexec failed with exit code $($proc.ExitCode)"
18+
}
19+
20+
Write-Host "Chrome uninstall complete (exit $($proc.ExitCode))"
21+
exit 0
22+
} catch {
23+
Write-Error $_
24+
exit 1
25+
} finally {
26+
Stop-Transcript
27+
}

0 commit comments

Comments
 (0)