I'm trying to run a query across the network to find something within the user profile section however the I have a problem with the script below:
@echo off
set file=c:\temp\computerlist.txt
for /f "Tokens=*" %%g in (%file%) do (
echo %%g>> c:\regquery.txt
reg query "\\%%g\hku" /s /f remotepath >> c:\temp\regquery.txt
echo.>> c:\temp\regquery.txt
echo.>> c:\temp\regquery.txt
)
Although the script works well it takes forever due to the amount of data in the HKU section so I need to narrow it down further however the next section below HKU is the users SID which is of course unique. It doesn't allow me to run a wildcard such as S-1-5* that would cut out most of the sections.
Can anyone assist me in making this script more efficient as its taking about 30 minutes a computer at the moment!