Archive for the ‘Excel’ tag
Converting Excel to CSV using PowerShell
Quick Script: Converting Excel[.xls] to Comma Separated Value[.csv]
Many times my data is in .xls format and I really need it in .csv to leverage the accessibility of the Import-CSV cmdlet.
I found this code on the ‘PowerShellCommunity.org’ web forum: Link
Code:
$xlCSV=6 $Excelfilename = "file.xls" $CSVfilename = "file.csv" $Excel = New-Object -comobject Excel.Application $Excel.Visible = $False $Excel.displayalerts=$False $Workbook = $Excel.Workbooks.Open($ExcelFileName) $Workbook.SaveAs($CSVfilename,$xlCSV) $Excel.Quit() If(ps excel){kill -name excel}
I have only tested this with Office 2003 Sp2. I will try with 2007/2010 and post my findings.
Hope this helps.
All information is provided on an AS-IS basis, with no warranties and confers no rights.
Exporting Server Network Configuration to Excel using PowerShell
Win32_NetworkAdapterConfiguration
Win32_NetworkAdapter
Recently I had to examine over 100+ servers and their network configurations prior to a network IP address change. I also wanted the output in an Excel file for easy transport to my group. I used the above two WMI classes to gather all the required data i needed, the script requires the Excel application installed on the machine to have access to the excel.application COM object. I used an .TXT file as the input for the script, the file contains the servers that I wanted to scan. The file is formatted with one server name per line with no spaces.
All information is provided on an AS-IS basis, with no warranties and confers no rights.
