Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Issue using powershell to get computername to use in a variable

$
0
0

I am having an issue getting the correct value from Powershell when using this:

$ComputerName =  env:computername
$FileName = $ComputerName + ".prefs"

When I do that, I get the value of MOST of the computername, however not the full computername.

What comes back is: FAKETEXT-WIN732_.prefs

It should be FAKETEXT-WIN732_vm.prefs

The computername is FAKETEXT-WIN732_vm

Is this because of the underscore in the computername? How do I circumvent this?

Thanks!

Jesse Rooney


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>