Tech Community Live: Microsoft Intune
Oct 01 2024, 07:30 AM - 11:30 AM (PDT)
Microsoft Tech Community

Below powershell script is not working on all the devices

Brass Contributor

Hi Guys,

I am trying to push below powershell script on intune through the Scripts option in Devices and it is working for some devices but not on all the devices. Basically we want to change the default font from Aptos to Verdana. Please suggest me here.. Powershell champs confirmed there is no issue in the script. FYI, if i run the below script directly in powershell as administrator it will work straight away and change the font in excel. If i don't run powershell as administrator and run the script it will throw error saying registry access is not allowed. Please help.

if((Test-Path -LiteralPath "HKCU:\Software\Policies\Microsoft\office\16.0\excel\options") -ne $true) { New-Item "HKCU:\Software\Policies\Microsoft\office\16.0\excel\options" -force -ea SilentlyContinue };
if((Test-Path -LiteralPath "HKCU:\Software\Policies\Microsoft\office\16.0\excel\options\binaryoptions") -ne $true) { New-Item "HKCU:\Software\Policies\Microsoft\office\16.0\excel\options\binaryoptions" -force -ea SilentlyContinue };
New-ItemProperty -LiteralPath 'HKCU:\Software\Policies\Microsoft\office\16.0\excel\options' -Name 'extractdatadisableui' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue;
New-ItemProperty -LiteralPath 'HKCU:\Software\Policies\Microsoft\office\16.0\excel\options' -Name 'font' -Value 'Verdana, 11' -PropertyType String -Force -ea SilentlyContinue;
New-ItemProperty -LiteralPath 'HKCU:\Software\Policies\Microsoft\office\16.0\excel\options' -Name 'disableautorepublish' -Value 1 -PropertyType DWord -Force -ea SilentlyContinue;
New-ItemProperty -LiteralPath 'HKCU:\Software\Policies\Microsoft\office\16.0\excel\options' -Name 'disableautorepublishwarning' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue;
New-ItemProperty -LiteralPath 'HKCU:\Software\Policies\Microsoft\office\16.0\excel\options\binaryoptions' -Name 'fupdateext_78_1' -Value 0 -PropertyType DWord -Force -ea SilentlyContinue;

Thanks,
Ram

2 Replies

@Rambo363636 

 

Can you please check the Intune Management Extension, try to locate the script trying to apply.  See here: https://learn.microsoft.com/en-us/mem/intune/apps/intune-management-extension#intune-management-exte...

 

If you need help with interpreting the logs files just provide snippets of the log so we can have a look.

 

@Rambo363636 

 

You cant change the policies registry key of the hkcu when you are not a local admin 🙂 If you want to change something in the hkcu of the logged in user, you need to make sure you are targeting the hkey_users and finding the logged in user and run the script as administrator

Something like this

Intune User / HKCU registry settings from system context (call4cloud.nl)