Using .Net Slideshow

  1. Function convertToCSV { 
  2.   Param ([string]$toConvert
  3.    
  4.      
  5.     $excel = New-Object -ComObject "Excel.Application"  
  6.     $workBook = $excel.workbooks.open($toConvert
  7.     if($toConvert -match ".xlsx"){ 
  8.     $global:target = $toConvert.replace(".xlsx",".csv")} 
  9.     else{$target = $toConvert.replace(".xls",".csv")} 
  10.     $workBook.SaveAs($target,6)  
  11.     $excel.displayalerts=$False  
  12.     $excel.quit()  
  13.  
  14.  
  15.  
  16. $toConvert = Read-Host "Type the path of the excel file" 
  17.  
  18. convertToCSV $toConvert 
  19.  
  20. $converted = Import-Csv -Path $target 
  21.  
  22. Get-Process | Export-Csv "d:\myTools\Compare\toCompare.csv"         ### 
  23.                                                                     ### Change this for your needs. Get-Process is just an example. 
  24. $toCompare = Import-Csv -Path "d:\myTools\Compare\toCompare.csv"    ### 
  25.  
  26. $newCSV = New-Object System.Collections.ArrayList 
  27.  
  28. for($i=0;$i -lt $converted.length; $i++){ 
  29.  
  30. for($j=0; $j -lt $toCompare.length; $j++){ 
  31.  
  32. if($converted[$i].processname -eq $toCompare[$j].processname){ ## Also change here to attend your requirements 
  33.  
  34. if(!$newCSV.contains($converted[$i])){ 
  35.  
  36. $newCSV.add($converted[$i]) | Out-Null}} 
  37.  
  38. }} 
  39.  
  40. $newCSV | Export-Csv d:\myTools\Compare\newCSV.csv  ## Change here as well. 
 
Loading...
Concentrated Tech NSoftware Dell Compellent Sponsored by Idera and Concentrated Tech and NSoftware and Dell Compellent
Copyright 2011 PowerShell.com. All rights reserved.