Hello Francesco
Good morning!
The Set-ExecutionPolicy Unrestricted -Scope CurrentUser
command can indeed affect the behavior of your PowerShell script, but it's not the primary cause of the "not applicable" issue.
The Set-ExecutionPolicy
command sets the execution policy for the current PowerShell session or for the system, depending on the scope specified. The -Scope CurrentUser
option sets the policy only for the current user, while the default scope is Machine
which sets the policy for all users on the machine.
In your case, if the script is not running on these 4 PCs due to being marked as "not applicable", it's likely because of one of the following reasons:
- Group Policy: Group Policy might be overriding the compliance policy's settings. Check if there are any conflicting Group Policy settings that might be preventing the script from running.
- Windows Defender Application Control (WDAC): WDAC might be blocking the script execution. Check if WDAC is enabled and configured to block specific files or scripts.
- Firewall rules: Firewall rules might be blocking the script's communication with Intune or other services. Check your firewall rules and ensure they allow communication with the required ports and services.
- Script dependencies: The script might rely on specific dependencies that are not present on these 4 PCs. Check if there are any missing dependencies, such as .NET Framework versions or other software components.
To resolve this issue, I recommend:
- Verify Group Policy settings and WDAC configurations.
- Check firewall rules and ensure they allow communication with Intune and other required services.
- Review the script dependencies and ensure they are present on all PCs.
- Try running a troubleshooting script on one of these PCs to gather more information about the issue.
As for making the changes persist across all users on the machine, you can use Set-ExecutionPolicy Unrestricted -Scope Machine
instead of -Scope CurrentUser
. This will set the execution policy for all users on the machine.Good morning!
The Set-ExecutionPolicy Unrestricted -Scope CurrentUser
command can indeed affect the behavior of your PowerShell script, but it's not the primary cause of the "not applicable" issue.
The Set-ExecutionPolicy
command sets the execution policy for the current PowerShell session or for the system, depending on the scope specified. The -Scope CurrentUser
option sets the policy only for the current user, while the default scope is Machine
which sets the policy for all users on the machine.
In your case, if the script is not running on these 4 PCs due to being marked as "not applicable", it's likely because of one of the following reasons:
- Group Policy: Group Policy might be overriding the compliance policy's settings. Check if there are any conflicting Group Policy settings that might be preventing the script from running.
- Windows Defender Application Control (WDAC): WDAC might be blocking the script execution. Check if WDAC is enabled and configured to block specific files or scripts.
- Firewall rules: Firewall rules might be blocking the script's communication with Intune or other services. Check your firewall rules and ensure they allow communication with the required ports and services.
- Script dependencies: The script might rely on specific dependencies that are not present on these 4 PCs. Check if there are any missing dependencies, such as .NET Framework versions or other software components.
To resolve this issue, I recommend:
- Verify Group Policy settings and WDAC configurations.
- Check firewall rules and ensure they allow communication with Intune and other required services.
- Review the script dependencies and ensure they are present on all PCs.
- Try running a troubleshooting script on one of these PCs to gather more information about the issue.
As for making the changes persist across all users on the machine, you can use Set-ExecutionPolicy Unrestricted -Scope Machine
instead of -Scope CurrentUser
. This will set the execution policy for all users on the machine.