# Script to set homepage in Edge on Windows devices

In corporate environments, users are often required to use a specific website. Conventionally, the homepage can be set from the browser settings. However, this can become a tedious task, especially when there are a large number of deployed devices. Using Hexnode’s [custom script](https://www.hexnode.com/mobile-device-management/help/executing-custom-scripts-for-windows/) feature, you can easily deploy scripts to all your devices and set the preferred homepage from your Hexnode portal.

 Disclaimer:The sample scripts provided below are adapted from third-party open-source sites.

 

Batch script
------------

Batch script to set homepage in edge

REG ADD "HKLM\\Software\\Policies\\Microsoft\\Edge" /v "RestoreOnStartup" /d 0x00000004 /t REG\_DWORD /f REG ADD "HKLM\\Software\\Policies\\Microsoft\\Edge\\RestoreOnStartupURLs" /v "1" /d "https://www.hexnode.com" /f 

   1

2

  REG ADD "HKLM\\Software\\Policies\\Microsoft\\Edge" /v "RestoreOnStartup" /d 0x00000004 /t REG\_DWORD /f

REG ADD "HKLM\\Software\\Policies\\Microsoft\\Edge\\RestoreOnStartupURLs" /v "1" /d "https://www.hexnode.com" /f 

   

 

  

Replace the URL mentioned in the script with the desired URL to be set as homepage.

PowerShell script 
------------------

Script to set homepage in Edge

$registryPath = 'HKLM:\\Software\\Policies\\Microsoft\\Edge' $regpath = 'HKLM:\\Software\\Policies\\Microsoft\\Edge\\RestoreOnStartupURLs' $value = 0x00000004 $URL= 'https://www.hexnode.com' if(!(Test-Path $registryPath)) { New-Item -Path $registryPath -Force | Out-Null New-ItemProperty -Path $registryPath -Name RestoreOnStartup -Value $value -PropertyType DWORD -Force | Out-Null} ELSE { New-ItemProperty -Path $registryPath -Name RestoreOnStartup -Value $value -PropertyType DWORD -Force | Out-Null} Set-Location $registrypath New-Item -Name RestoreOnStartupURLs -Force Set-Itemproperty -Path $regpath -Name 1 -Value $URL Write-Host "The homepage has been set as: $URL" 

   1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

  $registryPath = 'HKLM:\\Software\\Policies\\Microsoft\\Edge'

$regpath = 'HKLM:\\Software\\Policies\\Microsoft\\Edge\\RestoreOnStartupURLs'

$value = 0x00000004

$URL= 'https://www.hexnode.com'

if(!(Test-Path $registryPath))

{

New-Item -Path $registryPath -Force | Out-Null

New-ItemProperty -Path $registryPath -Name RestoreOnStartup -Value $value -PropertyType DWORD -Force | Out-Null}

ELSE {

New-ItemProperty -Path $registryPath -Name RestoreOnStartup -Value $value -PropertyType DWORD -Force | Out-Null}

Set-Location $registrypath 

New-Item -Name RestoreOnStartupURLs -Force 

Set-Itemproperty -Path $regpath -Name 1 -Value $URL 

Write-Host "The homepage has been set as: $URL" 

   

 

  

Replace the value provided for `$URL` with the desired URL to be set as homepage.

 What happens at device end 
----------------------------

The homepage for Microsoft Edge browser is set to the desired URL and is loaded whenever the browser is launched.

<https://cdn.hexnode.com/mobile-device-management/help/wp-content/uploads/2023/02/Set-homepage-in-Edge.mp4>

 Notes:- It is recommended to manually validate the script execution on a system before executing the action in bulk.
- Hexnode will not be responsible for any damage/loss to the system on the behavior of the script.