ZTree.com  | ZEN  | About...  

 Index   Back

[Help!] Running elevated Powershell from F9 ?   [Help!]

By: Laurent Duchastel     Montréal, Québec  
Date: Oct 09,2019 at 11:52
In Response to: [Help!] Running elevated Powershell from F9 ? (Ron Metzger)

> > Useless and intrusive Office Hub app keeps reinstalling itself. I
> > want to easily uninstall it routinely with a F9 script.
> >
> > How do I run this elevated Powershell script from F9 ?
> >
> > Get-AppxPackage *officehub* | Remove-AppxPackage
> >
> > This below *doesn't* work:
> >
> >
> > "%#ZTTOOLS%\elevate\elevate64" -c powershell.exe Get-AppxPackage
> *officehub* | Remove-AppxPackage
> >
> >
> > where elevate64 is a free utility to bypass UAC warning
> > http://code.kliu.org/misc/elevate/
> >
> > Thank you for your hint.
>
> Try "%#ZTTOOLS%\elevate\elevate64" -c -w ...
>
> Hope this helps, let us know.
>
> Ron Metzger


Solved the issue!

It wasn't the -w parameter which did the trick, but added quotation marks to delimit the PS script

"%#ZTTOOLS%\elevate\elevate64" -c powershell.exe "Get-AppxPackage *officehub* | Remove-AppxPackage"
pause


This leads to a question : what would be the best way to run with F9 a PS script that span many lines ?


Laurent Duchastel

134 views      
 

Messages in this Thread

 
94,671 Postings in 11,938 Threads, 348 registered users, 19 users online (1 registered, 18 guests)
Index | Admin contact |   Forum Time: Dec 15, 2019 - 6:23 pm EST  |  Hits:29,414,597  (2,339 Today )
RSS Feed