The obvious way:
Open Powershell Console in Advanced Mode β Right-click / exe and click Run as Administrator
. Or, on the Start menu, type Powershell and press CTRL + SHIFT + ENTER
Then run the commands from this.
Or you can have the commands in the script file (.ps1) and call the script:
start-process powershell -verb runas -argument script.ps1
I would also like to mention that in the yout commands you do not need to store it in the $app
, you can use something like:
Get-AppxPackage -all| Where-Object{$_.Name-like "$ReleaseName"} | Remove-AppxPackage
source share