Deploy a PowerShell script through Intune that writes the org URL to the registry on each device.
About this task
An Intune platform script runs once on each device after it succeeds. If it fails, Intune retries at the next three check-ins. To change the org URL, edit the script and upload it again in the script's properties. The changed script runs again on all assigned devices. The script doesn't restore the value if someone deletes it. Intune Remediations can rerun the script on a schedule, but they require Windows Enterprise E3 or E5, Education A3 or A5, or Windows Virtual Desktop Access (VDA) licensing.
For more information, see Add PowerShell Scripts to Windows Devices in Microsoft Intune.
Procedure
-
Copy the following script into a file named
Set-OktaSamOrgUrl.ps1.
# Okta SAM for Microsoft Edge: set the Okta organization URL
$OrgUrl = "https://your-org.okta.com" # <-- Replace with your Okta org URL
# Do not edit below this line
$ExtensionId = "ahgjkedohmecdnfgfggeboeccjjaiaif"
$Key = "HKLM:\SOFTWARE\Policies\Microsoft\Edge\3rdparty\extensions\$ExtensionId\policy"
if ($OrgUrl -notmatch '^https://[A-Za-z0-9.-]+$') {
Write-Error "Invalid OrgUrl '$OrgUrl'. Use the form https://yourorg.okta.com with no trailing slash or path."
exit 1
}
try {
New-Item -Path $Key -Force -ErrorAction Stop | Out-Null
Set-ItemProperty -Path $Key -Name "orgUrl" -Value $OrgUrl -Type String -ErrorAction Stop
Write-Output "Okta SAM orgUrl set to $OrgUrl"
exit 0
}
catch {
Write-Error "Failed to set Okta SAM orgUrl: $_"
exit 1
}
-
Replace the org URL in the
$OrgUrl line with yours. Don't add a trailing slash or a path.
-
Save the file with UTF-8 or ASCII encoding.
-
In the Intune admin center, go to .
-
Select Add, and then select Windows 10 and later.
-
On Basics, enter a name such as
Okta SAM - Edge orgUrl, and then select Next.
-
On Script settings, upload the script.
-
Set Run this script using the logged on credentials to No.
This runs the script as SYSTEM so it can write to the machine-wide registry key.
-
Set Enforce script signature check to No.
Set it to Yes only if your org signs scripts.
-
Set Run script in 64-bit PowerShell host to Yes.
This avoids 32-bit registry redirection.
-
Select Next.
-
Add scope tags if needed, and then select Next.
-
On Assignments, add the group you used for the certificate and Edge policy profiles, and then select Next.
Note: If the script doesn't run on a device, check whether the device is only Microsoft Entra registered. Devices that are only registered don't receive platform scripts. Join the device to Microsoft Entra ID.
-
On Review + add, select Add.
What to do next
Next, complete the steps in Verify the SAM plugin deployment.