New
#1
On how to run a .ps1 file as Administrator
Hello everyone,
If you have had a chance of going through the great Brink's Tutorial Apps - Uninstall in Windows 10 (I strongly advice you do), you may have noticed that, if you wish to automatize, at least to a certain extent, the procedure of getting rid of Windows 10 pre-installed bloatware (sorry, Apps would sound much better), you will inescapably bump into the need of creating a tailored .ps1 file.
More specifically, you may want to copy and paste into a text editor like Notepad your customized set of instructions and then saving it with the extension .ps1 rather than .txt (or, which is the same, save it as a .txt file and then, disregarding Windows warnings, change its extension to .ps1)
I hope an example might help. Let us assume I wish to uninstall, for instance, Alarms & Clock, Calendar and Mail, Candy Crush Soda Saga and Microsoft Solitaire Collection for all users. IMHO your file should be like this:
Get-appxpackage -allusers *windowsalarms* | Remove-AppxPackage
Get-appxpackage -allusers *windowscommunicationsapps* | Remove-AppxPackage
Get-appxpackage -allusers *CandyCrushSodaSaga* | Remove-AppxPackage
Get-appxpackage -allusers *solitairecollection* | Remove-AppxPackage
So far so good, copy and paste all of the above into Notepad, save it as a .ps1 file and everybody's content. Apart from the fact that when you launch it with PowerShell, which is the final purpose of the whole iteration, it inevitably crashes due to the fact that, apparently, for these kind of instructions you need Administraor's privileges. That is, to be even more clear, those privileges you get when you right-click on PowerShell in Menu and select Run as Administrator.
Which brings us to the question: how do I run a .ps1 file in PowerShell as Administrator?
Kindly note that I am logged in my PC's as Administrator (single user, as a matter of fact).
Thank you all in advance. :)
Last edited by Lmbrt; 16 May 2016 at 13:00.