Remotely grabbing username Tagged: Passing username to var This topic contains 3 replies, has 3 voices, and was last updated by Sam Boutros 2 years, 4 months ago. Author Posts July 18, 2014 at 12:35 pm #17296 Mark DiPofiParticipant 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. July 18, 2014 at 12:42 pm #17297 Mark DiPofiParticipant I was able to figure it out. Thank you July 18, 2014 at 12:47 pm #17298 Dave WyattModerator For environment variables, there's a shortcut syntax: $env:username I'm not sure where "Remotely" comes into this question, though. July 20, 2014 at 9:22 am #17320 Sam BoutrosParticipant $strName = (Get-Item -Path Env:\USERNAME).value Author Posts You must be logged in to reply to this topic.