Something that is rather niche is the need to change users displays. This need can occur for a number of reasons, one reason perhaps some systems require a specific resolution to work correctly. The issue here is when you need to have this applied across 100s and sometimes 1000s of devices suddenly it becomes a massive job and so we must turn to our great friend, PowerShell.
The first thing to do would be to open up PowerShell ISE add the following
Set-ExecutionPolicy RemoteSigned -Force -Scope CurrentUser
Import-Module PowerShellGet
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope CurrentUser
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
The reason we are forced to make use of the execution policy cmdlet is due to how we’re forced to deploy this via Intune. Normally when deploying a PowerShell script as a Win32 app we would set the system to run, however, in this case this simply is not an option. If the system attempts to run the change to the resolution nothing will happen, it has to be the user which runs this.
The second part handles the installation of the needed module which actually applies these changes via PSGallery. For this to work a minimum version of NuGet is needed. From here we have the final part of the script which actually completes the changes.
Install-Module -Name DisplaySettings -Confirm:$false -force
Import-Module -Name DisplaySettings -Confirm:$false -force
Set-DisplayResolution -Width 1366 -Height 768
This is pretty self explanatory, we are installed DisplaySettings module via PSGallery which allows us the ability to use the Set-DisplayResolution cmdlet. Be sure to change the actual -Width and -Height to what you need. From here you have the option to add a simple detection e.g mkdir and created a folder for testing later in Intune.
Now it’s time to convert this script into a usable .intunewin format which allows you to put it into Intune as a win32 app. I will need to create a guide on this later but for now you can find details on this here.
Once you have this ready you should go into Intune (https://endpoint.microsoft.com/) and navigate to all apps where you will create the app. You will then need to go through the app creation processes

Be sure to have Install behaviour switched to user or this will fail, you should also use the following install command.
powershell -windowstyle hidden -ex bypass -file ScreenResolution.ps1

Be sure to select both 32 and 64 bit systems via operating system architecture.

The last import thing to do is create a Detection rule, for myself I added the ability to create a folder in the primary script and set up Intune to detect this folder on it’s creation. This way I have the ability to detect if the script ran successfully.
And now simply complete until you have the app saved and having it applied to the correct groups, from here it should complete without issues. Below is the full script.
Set-ExecutionPolicy RemoteSigned -Force -Scope CurrentUser
Import-Module PowerShellGet
Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force -Scope CurrentUser
Set-PSRepository -InstallationPolicy Trusted -Name PSGallery
Install-Module -Name DisplaySettings -Confirm:$false -force
Import-Module -Name DisplaySettings -Confirm:$false -force
Set-DisplayResolution -Width 1366 -Height 768
mkdir c:\test1
Leave a Reply