Showing posts with label PowerShell. Show all posts
Showing posts with label PowerShell. Show all posts

Monday, January 18, 2016

Powershell Script to Enable Run As User in Windows 10

Windows 10 doesn't include a Run as Different User feature in the Start Menu by default.  This is a pain for those of us who need to elevate privileges within our corporate environments.

Fortunately, the fix is pretty simple: just add a registry key that enables the feature.  Unfortunately, I find myself having to do this on every computer I work from.  To make it easy for myself, I created a simple PowerShell script that I can look up here. So, without further ado, here's the script.


Monday, December 5, 2011

PowerShell Script to Get MAC Address from ARP Cache



I was inspired by Shay in his blog post about obtaining a MAC Address.

I wanted something a little more purposeful so I extended it a bit.  Enjoy.



Friday, February 25, 2011

Running a Powershell script in Vista/Windows 7 without prompting for elevation or security

Some time ago I needed to share a very simple PowerShell script with a user for a one-time execution.  Before I forget it I wanted to write it down.

At the time I didn't have the capability to sign the script but I didn't want to complicate things for the user by asking them to run an elevated prompt and re-configure PowerShell's execution policy for remote-signed code.  I looked around for a workaround and this is what I found.


First, the guys at Wintellect developed a simple workaround for elevation in the command shell for Vista or Windows 7.  Get a copy here: http://www.wintellect.com/cs/blogs/jrobbins/archive/2007/03/27/elevate-a-process-at-the-command-line-in-vista.aspx

Next, powershell has a command line option to bypass the execution policy.

Combining the two together in a batch file delivers a simple way to accomplish my objective:

elevate powershell.exe -nologo -noprofile -windowstyle hidden -command "& {set-executionpolicy Bypass -scope Process; .\myscript.ps1}"