Overview
This page provides a sample script required to silently install and activate the Josys browser extension on Windows devices using Microsoft Intune.
This is intended for those who fall under Case G (where multiple users do not log into a single device, users do not have administrator privileges on the device, and the USERNAME is the same as the local part of their email address) in How to Silently Install and Activate the Extension on Windows Devices Using Intune (2/2).
Target Audience
Those responsible for planning and executing the bulk deployment of the Josys browser extension.
About the Browser Extension
Please refer to the following pages first for information regarding the browser extension.
1. About the Browser Extension
2. How to Use the Browser Extension
Script
Please save the following script to run it in the system context.
- Copy the script below and paste it into a text editor such as Notepad.
- Replace YOUR_ORGANIZATION_KEY on the second line with your company's Organization Key, which can be found in Josys.
- Change @example.com at the bottom to your company's email domain.
Example: @josys.com - Save the file with the name "josys-extension-config.ps1".
- Confirm that the file type is "Windows PowerShell script".
- Return to How to Silently Install and Activate the Extension on Windows Devices Using Intune (2/2) - 2. Apply the Script to Target Devices and proceed with the steps.
####### Write Organization ID to Registry #######
$organizationKey = "YOUR_ORGANIZATION_KEY"
# Define target registry paths as an array (Chrome and Edge)
$registryPaths = @(
"HKLM:\Software\Policies\Google\Chrome\3rdparty\extensions\moaklgcgokbgplldonjkoochhlefkbjf\policy",
"HKLM:\Software\Policies\Microsoft\Edge\3rdparty\extensions\hjifncajikcdkhlofdjjlhcjoennmdfc\policy"
)
# Write to both Chrome and Edge paths
foreach ($registryPath in $registryPaths) {
# Create the registry path (key) only if it does not exist
if (!(Test-Path $registryPath)) {
New-Item -Path $registryPath -Force -ItemType Directory | Out-Null
}
# Write to registry only if the "OrganizationKey" value does not exist
# Specify -ErrorAction SilentlyContinue to continue processing even if Get-ItemProperty fails
if (!(Get-ItemProperty -Path $registryPath -Name "OrganizationKey" -ErrorAction SilentlyContinue)) {
New-ItemProperty -Path $registryPath -Name "OrganizationKey" -Value $organizationKey
}
}
####### The following code is not required if you perform automatic authentication from browser profiles #######
####### Retrieve Email Address ########
# Get username
$username = $null
while ($username -eq $null) {
$username = (Get-CimInstance Win32_Process -Filter 'name = "explorer.exe"' | Invoke-CimMethod -MethodName getowner).User
if ($username -is [array]) {
$username = $username[0]
}
Start-Sleep -Seconds 5 # Wait for 5 seconds (optional)
}
# 1. If the email address can be constructed from the username
# $username = $username -replace ' ', '.' # As needed
$userEmail = $username + "@example.com" # Change to your company's email domain
# 2. If retrieving the email address by other methods
# Enter code here
# Write to both Chrome and Edge paths
foreach ($registryPath in $registryPaths) {
# Process only if the registry path (key) exists
if (Test-Path $registryPath) {
# Write to registry only if the "UserEmail" value does not exist
if (!(Get-ItemProperty -Path $registryPath -Name "UserEmail" -ErrorAction SilentlyContinue)) {
New-ItemProperty -Path $registryPath -Name "UserEmail" -Value $userEmail
}
}
}
exit 0