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

Get-ChildItem Issue With Variable

$
0
0

I hope some very clever person out there can resolve this without even thinking, however my brain seems to be blocked.

$FileVersion= (Get-ChildItemC:\Windows\System32\drivers\somedriver.SYS).VersionInfo|Select-ObjectFileVersion

If ($FileVersion-eq"2, 0, 0, 1") {Copy-Item-Force"C:\local\somedriver.SYS","C:\Windows\System32\drivers\somedriver.SYS"

I have verified this and $FileVersion does in fact equal 2, 0, 0, 1 however starts as a formatted table.

FileVersion

-----------------

2, 0, 0, 1

I think it must be passing the variable as the whole table, I also tried adding in my if statement the value @{FileVersion=2, 0, 0, 1 however that also failed.

Any ideas what I'm missing here?

Many Thanks


Viewing all articles
Browse latest Browse all 15028

Trending Articles



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