Welcome › Forums › General PowerShell Q&A › Remotely grabbing username
This topic contains 3 replies, has 3 voices, and was last updated by
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
Thank you for assistance.
I was able to figure it out.
For environment variables, there's a shortcut syntax:
I'm not sure where "Remotely" comes into this question, though.
$strName = (Get-Item -Path Env:\USERNAME).value
The topic ‘Remotely grabbing username’ is closed to new replies.