TCMD PowerShell Tab elevated

Jul 12, 2008
270
0
Las Vegas, NV
I am trying to get a tab set up for PowerShell with elevated rights. I cannot seem to get there. If I just start PowerShell from a shortcut that is set to run as Administrator, it works. I can tell this by the command

[bool](([System.Security.Principal.WindowsIdentity]::GetCurrent()).groups -match "S-1-5-32-544")

That returns "True " when run.

But my TCMD tab that is set to run as Admin does not, and returns a "False" to the same string.

What am I doing wrong here? The one thing I see is that if I go to "Options / Take Command Tabs" and look at the PowerShell tab, the "Run As" fields are always empty. I enter the info, get no error, but the tab does not load as Admin, and then the fields are empty upon review.

What do I need to change here?
 
Code:
ver
TCC  24.00.29 x64   Windows 7 [Version 6.1.7601]
From an elevated TCMD session, if I do;
Code:
runas.exe /trustlevel:0x20000 powershell.exe
and then from PowerShell, if I do a
Code:
(New-Object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)
it returns false.

From an elevated TCMD session, if I do;
Code:
Powershell.exe -Command Start-Process PowerShell -Verb RunAs
and then from PowerShell, if I do a
Code:
New-Object System.Security.Principal.WindowsPrincipal([System.Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([System.Security.Principal.WindowsBuiltInRole]::Administrator)
it returns true.

@CWBillow is this a solution for you? That is, run TCMD elevated, but you have the ability to run PowerShell as Admin or not as Admin.

Joe
 
May 26, 2008
497
3
I don't think it's possible to run anything elevated in a tab in a non-elevated TCMD ... a Windows restriction.
I know TCMD doesn't support it, but ConEmu can do it. I run a mix of elevated and non-elevated console apps within a single ConEmu window. So it isn't a Windows restriction per se, but some tricks need to be done to get it to work.