'PowerShell Cannot dot-source this command because it was defined in a different language mode

I've created a Windows application package using Visual Studio and when I run Add-AppDevPackage.ps1 script I get this error on some computers.

Cannot dot-source this command because it was defined in a different language mode. To invoke this command without importing its contents omit the '.' operator`

I feel like this has something to do with the Group Policy since the particular device is an Enterprise issued Microsoft Surface 2. I cannot make any changes to this group policy.

How do I proceed to install this application on this device?

Anything in particular I should try?

Picture of error provided by employee running in to the issue



Solution 1:[1]

Have you tried unrestricted execution policy?

Set-ExecutionPolicy Unrestricted

Restrict it after you're done. It is a loophole if your admins didn't plug it.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Olegp