Cannot execute a windows script through Hexnode – remove Microsoft storeSolved

Participant
Discussion
16 hours ago

Hey folks,

Our team has been trying to remove the Microsoft store on our windows devices. They have created the following PowerShell script.

The script seems to work perfectly on the device itself when executed through Command Prompt. For some unknown reason, we aren’t able to execute it properly from the Hexnode console. The action history shows that the script execution was successful, and we even get the message ‘Microsoft Store has been removed successfully.’ But the app is untouched on the device.
Has anyone else faced the same issue with Windows script execution through Hexnode?

Replies (1)

Marked SolutionPending Review
Hexnode Expert
6 hours ago
Marked SolutionPending Review

Hello,

Thank you for reaching out to Hexnode Connect.

We understand your issue regarding custom PowerShell script execution on Windows devices.

When a script is executed through Hexnode, it typically runs at the System level. Since your current script does not mention a specific target user, the Remove-AppxPackage command struggles to execute correctly when remotely executed. The AppX Packages cmdlets are designed to operate at the user level, specifically for the current logged-in user when executed directly on the device.

To successfully remove the Microsoft Store across the entire device, the commands must be targeted system wide.

You can try adding the -AllUsers parameter to both the Get-AppxPackage and Remove-AppxPackage cmdlets. This parameter ensures the action is applied to all user profiles on the device.

Alternatively, you can use the code below, save it as a .ps1 file, and execute it through Hexnode. It will remove the Microsoft Store for all users and prevent it from being provisioned for new user profiles.

We hope this resolves your issue. If you require any further assistance, please feel free to reach out to us; we’re happy to help.

Regards,
George
Hexnode UEM

Save