With recent updates, the term "Member" on the screen has been changed to "User." If you still see "Member" in some parts of the help documentation, please read it as "User." For more details on this change, please refer to this announcement.
When logging into a device (domain), users log in using a shared ID instead of individual IDs. While identifying individual users is not necessary, you want to identify which PC is accessing the service.
Please register the PC as a user in Josys. When doing so, register the "Last Name," "Email Address" (a dummy address is fine), and "Binding ID (IT Device ID)." For the Binding ID (IT Device ID), register the PC name (COMPUTERNAME).
Script Overview
This script runs with system privileges. It writes the Josys Organization ID and the device name (COMPUTERNAME) to the HKLM registry for Chrome and Edge.
A log will be output to the location specified by the $logFilePath variable (C:\Windows\Temp\Set-BrowserExtensionPolicy_Error.log in the sample) only if an error occurs.
Required Modifications Before Use
Change YOUR_ORGANIZATION_KEY_HERE in $organizationKey = "YOUR_ORGANIZATION_KEY_HERE" to your actual Josys Organization ID.
Modify $logFilePath = "C:\Windows\Temp\Set-BrowserExtensionPolicy_Error.log" to change the folder path where the log is output, if necessary.
How to Use
Copy the script below, paste it into Notepad or a similar text editor, and select "Save As." Set the file extension to .ps1 and select UTF-8 (with BOM) as the character encoding.
After saving, proceed with the configuration by referring to the software distribution method in SKYSEA Client View.
*Please register the PC as a user in Josys. When doing so, register the "Last Name," "Email Address" (a dummy address is fine), and "Binding ID (IT Device ID)." For the Binding ID (IT Device ID), register the PC name (COMPUTERNAME).
<#
.SYNOPSIS
Writes specified policy values (OrganizationKey and DeviceIdentity) to the HKLM registry hive for both Chrome and Edge extensions.
This applies to all users on the device.
ERROR LOGGING ENABLED: Writes a log file only if an error occurs.
.DESCRIPTION
Modified version: Targets HKLM.
- Sets OrganizationKey
- Sets DeviceIdentity to the local Computer Name
#>
# --- Configuration Settings ---
# Set the OrganizationKey value here (Mandatory)
$organizationKey = "YOUR_ORGANIZATION_KEY_HERE" # Replace with your actual key
# HKLM Registry key paths for the specific extensions
$chromePath = "Registry::HKEY_LOCAL_MACHINE\Software\Policies\Google\Chrome\3rdparty\extensions\moaklgcgokbgplldonjkoochhlefkbjf\policy"
$edgePath = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Edge\3rdparty\extensions\hjifncajikcdkhlofdjjlhcjoennmdfc\policy"
# Log settings
$logFilePath = "C:\Windows\Temp\Set-BrowserExtensionPolicy_Error.log" # エラー時に出力されるログのパス
# --- End of Configuration Settings ---
# --- Logging Setup ---
$logBuffer = New-Object System.Collections.Generic.List[string]
$errorOccurred = $false
function Add-Log {
param (
[string]$Message,
[string]$Type = "INFO"
)
$timestamp = Get-Date -Format "yyyy/MM/dd HH:mm:ss"
$logEntry = "[$timestamp] [$Type] $Message"
$script:logBuffer.Add($logEntry)
if ($Type -eq "ERROR") {
$script:errorOccurred = $true
}
}
# --- Script Body ---
Add-Log "Script started. Processing HKLM policies for Chrome and Edge extensions."
# Get Computer Name
$computerName = $env:COMPUTERNAME
Add-Log "Target Computer Name: $computerName"
# Basic check if OrganizationKey is set
if ([string]::IsNullOrWhiteSpace($organizationKey) -or $organizationKey -eq "YOUR_ORGANIZATION_KEY_HERE") {
Add-Log "Please set a valid value for the `$organizationKey variable at the top of the script." -Type "ERROR"
$logBuffer | Out-File -FilePath $logFilePath -Encoding UTF8
exit 1
}
# --- Process Chrome Path (HKLM) ---
Add-Log "--- Processing Chrome Path (HKLM) ---"
try {
# Ensure the Chrome registry key exists
if (-not (Test-Path -Path $chromePath)) {
Add-Log "Chrome registry key does not exist. Creating..."
New-Item -Path $chromePath -Force -ErrorAction Stop | Out-Null
}
# 1. Set OrganizationKey
New-ItemProperty -Path $chromePath -Name "OrganizationKey" -Value $organizationKey -PropertyType String -Force -ErrorAction SilentlyContinue
if ($?) { Add-Log "Successfully set Chrome 'OrganizationKey'." }
else { Add-Log "Failed to set Chrome 'OrganizationKey'. Last Error: $($error[0].Exception.Message)" -Type "ERROR" }
# 2. Set DeviceIdentity (Computer Name)
New-ItemProperty -Path $chromePath -Name "DeviceIdentity" -Value $computerName -PropertyType String -Force -ErrorAction SilentlyContinue
if ($?) { Add-Log "Successfully set Chrome 'DeviceIdentity' to '$computerName'." }
else { Add-Log "Failed to set Chrome 'DeviceIdentity'. Last Error: $($error[0].Exception.Message)" -Type "ERROR" }
} catch {
Add-Log "An error occurred while processing Chrome registry: $($_.Exception.Message)" -Type "ERROR"
}
# --- Process Edge Path (HKLM) ---
Add-Log "--- Processing Edge Path (HKLM) ---"
try {
# Ensure the Edge registry key exists
if (-not (Test-Path -Path $edgePath)) {
Add-Log "Edge registry key does not exist. Creating..."
New-Item -Path $edgePath -Force -ErrorAction Stop | Out-Null
}
# 1. Set OrganizationKey
New-ItemProperty -Path $edgePath -Name "OrganizationKey" -Value $organizationKey -PropertyType String -Force -ErrorAction SilentlyContinue
if ($?) { Add-Log "Successfully set Edge 'OrganizationKey'." }
else { Add-Log "Failed to set Edge 'OrganizationKey'. Last Error: $($error[0].Exception.Message)" -Type "ERROR" }
# 2. Set DeviceIdentity (Computer Name)
New-ItemProperty -Path $edgePath -Name "DeviceIdentity" -Value $computerName -PropertyType String -Force -ErrorAction SilentlyContinue
if ($?) { Add-Log "Successfully set Edge 'DeviceIdentity' to '$computerName'." }
else { Add-Log "Failed to set Edge 'DeviceIdentity'. Last Error: $($error[0].Exception.Message)" -Type "ERROR" }
} catch {
Add-Log "An error occurred while processing Edge registry: $($_.Exception.Message)" -Type "ERROR"
}
Add-Log "------------------------------------------------------------"
Add-Log "Script execution finished."
# --- Final Check: Save Log if Error Occurred ---
if ($errorOccurred) {
try {
$logBuffer | Out-File -FilePath $logFilePath -Encoding UTF8 -Force
} catch {
# Fallback if logging fails
}
}