Exporting msinfo32 info


Author
Message
dyhs
dyhs
Proficient Member
Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)
Group: Forum Members
Posts: 164, Visits: 640
Hi,

Is there a script to run msinfo32 and export its report to the same location of a MR backup, everytime a scheduled backup task is run?
[edited to clarify the question]

I took the idea from a Linux backup utility does something like that by creating a few extra files (Info-lspci.txt, Info-dmi.txt, Info-lshw.txt) inside the disk image directory.


Tags
Edited 8 July 2017 11:14 AM by dyhs
jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)
Group: Forum Members
Posts: 3.5K, Visits: 26K
I have a PowerShell-based script that pulls a lot of things shown in MSInfo32 and some things that aren't.  The default operation creates a multi-sheet Excel workbook since I designed it to be used to pull information from multiple boxes in a single execution, but if you add the "-quick" parameter, it will output the most useful information to the console instead, which can of course be piped into a text file instead.  Maybe this will get you what you need?  Change the extension from .txt to .ps1 and target "Localhost" as the computer name.  The script also has full documentation at the top of the file in a format compliant with the Get-Help cmdlet.

(EDIT: Updated version of the script attached in later post. Original version removed.)

Edited 23 August 2017 6:37 PM by jphughan
dyhs
dyhs
Proficient Member
Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)
Group: Forum Members
Posts: 164, Visits: 640
Great! Thank you! 

For now, I tried it manually in the PS shell with the -quick and -app parameters and successfully retrieved computer information. 

Get-CompInv -ComputerFile: ListofComputers.txt -app -quick > ComputerInfo.txt

On the other hand, when I tried without the -quick parameter, the script went on creating endless empty worksheets, but it happens because I am using a localized (non-English) version of Excel. I fixed that by "localizing" Sheet6 and Sheet7 in the do-until loop. Now it runs fine.


p.s. I've just edited my original question in order to clarify it.
Edited 8 July 2017 11:32 AM by dyhs
jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)
Group: Forum Members
Posts: 3.5K, Visits: 26K
Interesting note about the Excel worksheets and localization!  It's funny because an earlier version of that script I had it specifically create a set number of worksheets, but that didn't yield consistent results because Excel 2003 and 2007 open new files with 3 worksheets and Excel 2010 defaults to 1.  I didn't really want to add a bunch of complexity by performing some sort of version checking, but I'll see if the number of worksheets has a "count" property that I can use to determine when the appropriate number of sheets has been created.  Glad you find it useful though! Smile

jphughan
jphughan
Macrium Evangelist
Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)Macrium Evangelist (5.1K reputation)
Group: Forum Members
Posts: 3.5K, Visits: 26K
Updated version of that script attached, with a few changes:

1. I changed the logic for adding worksheets to be based on the count of worksheets rather than looking for a worksheet named "Sheet6" or "Sheet7". It will now work regardless of localization settings.
2. Configured the Apps list to display in table format when the "-quick" switch is specified rather than in list format.  I tried doing that for the disk and network adapter sections as well, but those tend not to have as many items and the table for network adapters was too wide, and I didn't want users to have to scroll horizontally to see all of the information. The Apps list will usually fit onto a typical modern display without horizontal scrolling, but even if it doesn't (due to a very long application name, for example), I felt that with the number of items typically returned there, the table format was still a superior format overall, and Apps isn't a typically used switch anyway.
3. Changed the "App" switch to "Apps", which I'd meant to do for a while anyway.  "App" will still work though, since PowerShell accepts abbreviations as long as there's no ambiguity.

Attachments
Get-CompInv.txt (0 views, 31.00 KB)
Edited 1 March 2018 9:17 PM by jphughan
dyhs
dyhs
Proficient Member
Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)
Group: Forum Members
Posts: 164, Visits: 640
Good job!

Here is a way to list running tasks too.

Install-Module ImportExcel

Get-Process | Export-Excel ps.xlsx –Show

Credits: Doug Finke
Edited 9 July 2017 8:33 PM by dyhs
dyhs
dyhs
Proficient Member
Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)Proficient Member (267 reputation)
Group: Forum Members
Posts: 164, Visits: 640
Like I said, I am trying to integrate my computer backup task and saving current msinfo32 information to a file at the same time.
The good news is MR's own "Generate PS script from backup definition file" command allows to specify an external program to be executed when a backup is run.
I had MR generate the script with options Program = C:\windows\system32\msinfo32.exe and Parameters = /nfo e:\backupfolder\msinfo32.nfo 
which means run msinfo32 and save all the information to a .nfo file.
Then I manually edited a line in the generated script in order to automatically add the computer name to the file name, and include current date and time too.
See attached file. If you want to try it, of course you have to edit it and enter your own backup definition file and backup folder.

To do, perhaps: make it work with a schedule. Now it has to be run manually.



Attachments
Edited 10 July 2017 8:13 PM by dyhs
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search