3

I'm fairly new to the world of Powershell and currently I'm trying to push a Powershell script via Intune to the company devices (all Windows 10 21H2 machines) that will show the file extensions in File Explorer.

So far, I've found this:

Set-Itemproperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced' -Name 'HideFileExt' -value 0

The PS script is pushed via Intune to a test device and the monitor tells me the policy is applied successfuly but the file extensions are still not visible.

Is there something wrong with the line of code?

2
  • 2
    The script works fine. I am positive that it is not applied successfully, despite Intune telling you it did. While it is not part of that question, I suppose you should check the user context in which the script is applied and if the eventvwr or any other possible source tells you why the script did not apply correctly. Also, after trying the script locally for myself, you need to refresh the explorer tab via f5 for the change to apply. Commented Feb 9, 2022 at 14:10
  • 1
    I checked and indeed, the problem was Intune and not the script. Intune used the credentials of the user logged in to run the script (and thus not an elevated Powershell prompt). After changing it from user context to device context, it worked Thankyou for your answer! Commented Feb 9, 2022 at 15:16

2 Answers 2

1

My original comment which helped:

The script works fine. I am positive that it is not applied successfully, despite Intune telling you it did. While it is not part of that question, I suppose you should check the user context in which the script is applied and if the eventvwr or any other possible source tells you why the script did not apply correctly. Also, after trying the script locally for myself, you need to refresh the explorer tab via f5 for the change to apply.

Solution was to set it as system/device rights, since it was indeed run as user context, hence solving the problem.

Sign up to request clarification or add additional context in comments.

Comments

0

There shouldn't be anything wrong with the code, the issue is that you must restart explorer in order for the change to take effect

Stop-Process -ProcessName explorer -Force
Start-Process explorer

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.