Author Posts

July 18, 2014 at 12:35 pm

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

I was able to figure it out.
Thank you

July 18, 2014 at 12:47 pm

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

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