0

I have a logon script that logs several pieces of information and does it for a per device basis and then pipes it to a txt with the file name Computer-Name-report.txt

The company has hundreds of devices that are joined to the domain and subsequently affected by this logon script, is there an easy way to export all txt files in a folder to a csv or xlsx?

Here is the batch script I use to get the details:

wmic Computersystem get username > "ENTER-FOLDER-LOCATION-HERE\%computername%-report.txt"
wmic computersystem get name >> "ENTER-FOLDER-LOCATION-HERE\%computername%-report.txt"
wmic os get Name >> "ENTER-FOLDER-LOCATION-HERE\%computername%-report.txt"
wmic bios get serialnumber >> "ENTER-FOLDER-LOCATION-HERE\%computername%-report.txt"
wmic computersystem get model >> "ENTER-FOLDER-LOCATION-HERE\%computername%-report.txt"
wmic os get installdate >> "ENTER-FOLDER-LOCATION-HERE\%computername%-report.txt"
wmic cpu get Name >> "ENTER-FOLDER-LOCATION-HERE\%computername%-report.txt"
wmic memorychip get capacity >> "ENTER-FOLDER-LOCATION-HERE\%computername%-report.txt"

This is how it outputs:

UserName         
MY_DOMAIN\Joe.Bloggs  
Name         
Lap-001  
Name                                                               
Microsoft Windows 10 Professional|C:\WINDOWS|\Device\Harddisk0\Partition2  
SerialNumber      
CP2978763476223  
Model   
HP ProDesk 820  
InstallDate                
20160101010000.000000+060  
Name                                     
Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz  
Capacity    
4294967296  
4294967296  
4294967296  
4294967296

Would it be plausible to import all that under suitable table headings?

3
  • 2
    Why don't you modify your batch file to write a CSV file as it's output? Hint: Save the values returned from wmic and at the end write a header line and then all the values on the next line.
    – DavidPostill
    Oct 25, 2016 at 20:32
  • I don't think that'd work? I've imported things into csv before however the data would repeat every time a user logs on, creating an overwhelming amount of duplicates?
    – TechKno
    Oct 26, 2016 at 16:02
  • You could overwrite the file everytime ...
    – DavidPostill
    Oct 26, 2016 at 16:23

0

You must log in to answer this question.

Browse other questions tagged .