• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 952
  • Last Modified:

determine windows and ms office versions with script and email results.

I need to perform a basic software audit on over 300 pc's and don't want to burden the users with software installed or convoluted procedures.
I need to know the MS Windows version (and architecture if possible), the MS Office version and if possible, the highest DotNetFramework version installed.

I was thinking a script might be able to do this...   but I'd like the output of the query emailed to me or displayed in a text file that the user can copy/paste into an email to send to me.

A few google searches suggest I could use for example:
reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "ProductName"

Open in new window

reg query "HKEY_CLASSES_ROOT\Word.Application\CurVer"

Open in new window

but I don't know how to output the results into a usable format.

Is there any suggestions for scripts or small programs that could do what I need?

There is this one executable (attached as a zip that you will need to decompress and change the extension of the file inside back to an exe) that is perfect, but I can't use it because it's for a proprietary software install and contains hyperlinks, logos and company names that I don't want plastered all over the place.
Reece Dodds
Reece Dodds
  • 2
1 Solution
To output in a usuable format, you can do something like

reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "ProductName" > c:\temp\%computername%.txt

reg query "HKEY_CLASSES_ROOT\Word.Application\CurVer" >> c:\temp\%computername%.txt

who put the result in c:\temp\hostname.txt

Then, you can copy it in a shared folder or send it per mail with a DOS program called sendmail...
Reece DoddsAuthor Commented:
Thanks for the suggestion.

I'm trying the following as a batch file using BLAT to send the mail:

Set SoftwareVersions=C:\%computername%.txt
Set EmailLogFile=C:\Email-Log.txt
set EmailServer=mail.serveraddress.com
set EmailFrom=ithelpdesk@serveraddress.com
set EmailTo=myemail@serveraddress.com
set EmailSubject=%~nx0: Software Test Results
REM Optional; leave empty if the user running the task can send directly to the smtp server:
set EmailUser=ithelpdesk
REM Because of passwords potentially containing characters with special meaning in batch,
REM the password string *has* to be enclosed in double quotes when setting the variable!
set EmailPass="MyPassword132!"

reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "ProductName" > %SoftwareVersions%
reg query "HKEY_CLASSES_ROOT\Word.Application\CurVer" >> %SoftwareVersions%

if "%EmailUser%"=="" (
	set LogonOption=
) else (
	set LogonOption= -u "%EmailUser%" -pw %EmailPass%
"http://locationoffiles.serveraddress.com/blat307/full/blat.exe" %SoftwareVersions% -server %EmailServer% -f %EmailFrom% -t %EmailTo% -s "%EmailSubject%" %LogonOption% >"%EmailLogFile%" 2>&1

Open in new window

But I'm getting the message "The filename, directory name, or volume label syntax is incorrect." in the email log file that is created.

Where am I going wrong?
I've tried with success with :


Set SoftwareVersions=C:\%computername%.txt

reg query "HKLM\Software\Microsoft\Windows NT\CurrentVersion" /v "ProductName" > %SoftwareVersions%
reg query "HKEY_CLASSES_ROOT\Word.Application\CurVer" >> %SoftwareVersions%

\\server\share\mailsend.exe -smtp MAILSERVER -d DOMAIN -t EMAILTO +bc -f EMAILFROM -sub "MAIL SUBJECT" -attach "%SoftwareVersions%,text/plain,i" -M "SEE ATTACHED DOC"

The mailsend program can be downloaded here, it's a single .exe file :

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now