Firstly, don't output straight to an .xlsx file. That file format consists of a collection of XML data in a zip compressed container. Use .csv instead.
Next, if your domain allows remote registry queries, you can use
reg query \\remotemachine\HKLM\etc.
to query registry values over the network. In a cmd console, enter reg query /? for full details.
If your domain does not allow remote registry queries, as an alternative to psexec, you could try using wmic with its remote switches, querying the StdRegProv class. Assuming the "PRODUCTVERSION" value is held in a string value, it would look something like this:
wmic /node:computername /user:domain\admin /password:adminpass /namespace:\\root\default class stdregprov call GetStringValue hDefKey="&H80000002" sSubkeyName="SOFTWARE\\Symantec\\Symantec Endpoint Protection\\CurrentVersion" sValueName="PRODUCTVERSION" | findstr "sValue"
Or with variables to make it more readable:
@echo off & setlocal
set "user=domain\admin"
set "pass=adminPass"
set "creds=/user:%user% /password:%pass%"
set "GetStringValue=/namespace:\\root\default class stdregprov call GetStringValue"
set hive=hDefKey^^^="^&H80000002"
set key=sSubkeyName^^^="SOFTWARE\\Symantec\\Symantec Endpoint Protection\\CurrentVersion"
set valname=sValueName^^^="PRODUCTVERSION"
set "args=%creds% %GetStringValue% %hive% %key% %valname%"
rem // output to c:\versions.csv
> "c:\versions.csv" (
rem // loop through ips.txt
for /f "usebackq delims=" %%I in ("c:\ips.txt") do (
rem // capture output of wmic command
for /f "tokens=2*" %%x in ('wmic /node:%%I %args% ^| find "sValue"') do (
rem // normalize encoding of response and output to csv file
for /f "delims=" %%# in ("%%~y") do echo %%~I,%%~#
)
)
)
Note: I haven't performed extensive testing of this script, as I'm not currently in a domain environment. If it doesn't work as expected, you're probably on your own to figure out what's wrong and fix it. As far as I could, I did test the evaluation of the caret escapes, and was able to query the registry on my local machine without the /node, /user, and /password switches. And I have successfully used similar methods to query remote machines on a domain in the past where more traditional remote registry queries are blocked.