Force Script 2022
I am pushing a PS script to Intune machines on my tenant to change the Ethernet network adapter's network category from Public to private. This is to turn off the VPN automatically when the machine is on an Ethernet network.
Force Script 2022
I have prepared scripts for a client with the intent that each time a staff member logs in to a new device the script would kick off. I have found this is not the case. Seems the only way is to create a new script (or edit an existing one). This defeats the purpose of the script.
Please understand that the Intune management extension agent checks with Intune once every hour and after every reboot for any new scripts or changes. After you assign the policy to the Azure AD groups, the PowerShell script runs, and the run results are reported. Once the script executes, it doesn't execute again unless there's a change in the script or policy. If the script fails, the Intune management extension agent retries the script three times for the next three consecutive Intune management extension agent check-ins.
If you want to force run the script, you can restart the IntuneManagementExtension service in task manager and and the script will rerun again on this device. Also, a restart on the device or restart service triggers the script. Here is a good sample: -2-deep-dive-microsoft-intune-management-extension-powershell-scripts/
If you want scripts to run multiple times for a user, you'll need to deploy a method of removing the key, reassigning the script or scheduling it as a task. Reference: -us/mem/intune/apps/intune-management-extension
That's really counterproductive. Why Microsoft makes things so complicated? There should be a simple way as it is in SCCM to run the script again. Currently, even if you change the script or re-deploy it to the collection, you have to wait some random time or reboot the computer. What if you correct your script a few times? It may take a few days to test it this way. ...And the solution seems to be ...to create a second script, which deletes some registry keys or restarts the service, and to wait a random time or reboot the computer, so this script runs and then to wait for the first script to re-run? Brilliant idea! :)
I totally agree. Given that nearly all of the AD Group Policy Preferences functionality has moved to PowerShell scripts in InTune, having the equivalent functionality and immediacy as AD would