Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $sn = get-content c:\users\matt\desktop\Test\sn.txt
- $name = get-content c:\users\matt\desktop\Test\name.txt
- $tipweb = get-content c:\users\matt\desktop\Test\tipweb.txt
- $ipadlookupname = get-content c:\users\matt\desktop\Test\ipadlookupname.txt
- $mdmname = get-content c:\users\matt\desktop\Test\mdmname.txt
- $historicalname = get-content c:\users\matt\desktop\Test\historicalname.txt
- $total = $sn.length;
- $total2 = $total - 1;
- $entry = New-Object 'object[,]' $sn.length,6
- $a = New-Object -comobject Excel.Application
- $a.visible = $True
- $b = $a.Workbooks.Add()
- $c = $b.Worksheets.Item(1)
- $c.Cells.Item(1,1) = "Serial number"
- $c.Cells.Item(1,1).ColumnWidth = "15"
- $c.Cells.Item(1,2) = "Name Tipweb"
- $c.Cells.Item(1,2).ColumnWidth = "5"
- $c.Cells.Item(1,3) = "Tipweb #"
- $c.Cells.Item(1,3).ColumnWidth = "13.5"
- $c.Cells.Item(1,4) = "iPadlookup name"
- $c.Cells.Item(1,4).ColumnWidth = "14.7"
- $c.Cells.Item(1,5) = "mdm name"
- $c.Cells.Item(1,5).ColumnWidth = "13.5"
- $c.Cells.Item(1,6) = "historical name"
- $c.Cells.Item(1,6).ColumnWidth = "13.5"
- $d = $c.UsedRange
- $d.Interior.ColorIndex = 19
- $d.Font.ColorIndex = 11
- $d.Font.Bold = $True
- $d.EntireColumn.AutoFit($True)
- $num = 2;
- for ($int = 0; $int -lt $total; $int+=1) {
- #Entry[int, (0-5 for serial,name,tipweb, ipadlookup, mdm, historical)
- $entry[$int,0] = $sn[$int]
- $entry[$int,1] = $name[$int]
- $entry[$int,2] = $tipweb[$int]
- $ipadline = get-content c:\users\matt\desktop\Test\ipadlookupsn.txt | select-string -Pattern $sn[$int] | select-object LineNumber
- $entry[$int,3] = $ipadlookupname[($ipadline.linenumber-1)]
- $mdmline = get-content c:\users\matt\desktop\Test\mdmsn.txt | select-string -Pattern $sn[$int] | select-object LineNumber
- $entry[$int,4] = $mdmname[($mdmline.linenumber-1)]
- $snline = get-content c:\users\matt\desktop\Test\historicalsn.txt | select-string -Pattern $sn[$int] | select-object LineNumber
- $entry[$int,5] = $historicalname[($snline.linenumber-1)]
- $c.Cells.Item($num, 1) = $entry[$int,0]
- $c.Cells.Item($num, 2) = $entry[$int,1]
- $c.Cells.Item($num, 3) = $entry[$int,2]
- $c.Cells.Item($num, 4) = $entry[$int,3]
- $c.Cells.Item($num, 5) = $entry[$int,4]
- $c.Cells.Item($num, 6) = $entry[$int,5]
- $num = $num + 1
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement