Remotely grabbing username

This topic contains 3 replies, has 3 voices, and was last updated by  Sam Boutros 3 years, 11 months ago.

  • Author
  • #17296

    Mark DiPofi

    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

    Mark DiPofi

    I was able to figure it out.
    Thank you

  • #17298

    Dave Wyatt

    For environment variables, there's a shortcut syntax:


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

  • #17320

    Sam Boutros
    $strName = (Get-Item -Path Env:\USERNAME).value

You must be logged in to reply to this topic.