1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Power Shell in a TCMD window

Discussion in 'Support' started by CWBillow, Jun 5, 2016.

  1. CWBillow

    Joined:
    Jul 12, 2008
    Messages:
    194
    Likes Received:
    0
    If I run TCMD as Administrator (option on shortcut) do the tabs that I then open -- such as PowerShell -- inherit those Admin properties?

    Regards,
    Chuck Billow
     
  2. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,287
    Likes Received:
    39
    That's the way it works for CMD.EXE. I assume PowerShell would be the same.
     
  3. rconn

    rconn Administrator
    Staff Member

    Joined:
    May 14, 2008
    Messages:
    9,804
    Likes Received:
    82
  4. CWBillow

    Joined:
    Jul 12, 2008
    Messages:
    194
    Likes Received:
    0
    Cool. IS there a way I could have found that out "on my own" from TCMD or the software running in the tabs?
     
  5. vefatica

    Joined:
    May 20, 2008
    Messages:
    7,883
    Likes Received:
    29
    You can ask PowerShell (of course it isn't easy). Here's a simplification of some code I Googled up.

    Code:
    $wid=[System.Security.Principal.WindowsIdentity]::GetCurrent()
    $prp=new-object System.Security.Principal.WindowsPrincipal($wid)
    $adm=[System.Security.Principal.WindowsBuiltInRole]::Administrator
    $IsAdmin=$prp.IsInRole($adm)
    if ($IsAdmin) { echo yes }
     
  6. Charles Dye

    Charles Dye Super Moderator
    Staff Member

    Joined:
    May 20, 2008
    Messages:
    3,287
    Likes Received:
    39
    If you run CMD.EXE in a tab in an elevated Take Command, the tab caption will start with "Administrator:" -- reflecting the underlying console window.
     

Share This Page