Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources: Active Threads
Viewing all articles
Browse latest Browse all 8411

New PS user - selecting items from an array...

$
0
0

I have put together a script by pulling from various lines of scripts across the web.  My goal is to search a txt file of computer names and then query these for the version of Internet Explorer they have and to output the computer name (from the list) along with the object (productversion).  I am having difficulty getting the latter two items together and exported out to a csv file.

The output I want is this:

Computer                  Product Version
computername          internet explorer ver x.x

Instead of this: (which my current script produces)

ProductVersionFileName
9.00.8112.16421\\HFSFS077528756\c$\program files\internet explorer\iexplore.exe

My crude script follows.....

$col= @()
$computer=get-content-pathc:\batchfiles\pclistforie.txt

 

 

 

"Processing, please wait..."

foreach 

 

 

($linein$computer)

       {

 

$iefile="\\$line\c$\program files\internet explorer\iexplore.exe"

 

 

 

         $FileExists=Test-Path$iefile

 

 

 

         if ($FileExists-eq$true)

 

           {

 

$iever= (dir"$iefile"|%{ $_.versioninfo}) | where-Object
              {
$_.productversion -ne '8.00.7600.16385'} |select-object  productversion,filename

 

 

 

 

$col+=$iever

          }

 

}

 

$col 

 

 

| export-csv'c:\batchfiles\lefttodo.csv'-notypeinformation

"****************************"

"Completed...."

 

 


Viewing all articles
Browse latest Browse all 8411

Latest Images

Trending Articles



Latest Images