Remotely grabbing username

Welcome Forums General PowerShell Q&A Remotely grabbing username

This topic contains 3 replies, has 3 voices, and was last updated by

4 years, 8 months ago.

  • Author
  • #17296

    Points: 0
    Rank: Member

    I am using Get-item env:\username and I would only like to grab the value so I can set it to $strname

    PS C:\Users\testuser> Get-Item env:\username

    Name Value
    —- —–
    USERNAME testuser

    Thank you for assistance.

  • #17297

    Points: 0
    Rank: Member

    I was able to figure it out.
    Thank you

  • #17298

    Points: 0
    Rank: Member

    For environment variables, there's a shortcut syntax:


    I'm not sure where "Remotely" comes into this question, though.

  • #17320

    Points: 240
    Helping Hand
    Rank: Participant
    $strName = (Get-Item -Path Env:\USERNAME).value

The topic ‘Remotely grabbing username’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort