List PC Names and browser versions #2

bfuchs
bfuchs used Ask the Experts™
on
Hi Experts,

This is in regards to the following question.

https://www.experts-exchange.com/questions/29154904/List-PC-Names-and-browser-versions.html#a42927703

In addition, that script only works for IE, I would like to add check for Chrome, Safari and Firefox as well?

Whoever has an answer kindly post it here.

Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Firefox x64 on Windows x64 or Firefox x86 on Windows x86:
reg query HKLM\SOFTWARE\Mozilla\Mozilla Firefox /v CurrentVersion >> %youlogfile%

Open in new window

Firefox x86 on Windows x64
reg query HKLM\SOFTWARE\Wow6432Node\Mozilla\Mozilla Firefox /v CurrentVersion >> %youlogfile%

Open in new window

Chrome

dir "C:\Program Files (x86)\Google\Chrome\Application\" /ad  /b >> %youlogfile%

Open in new window


Anyway, depending on the number of systems you're running in your environment I'd recommend an invertory software. I personally like PDQ Inventory. In combination with PDQ Deploy you can update the software ob all your PCs.

https://www.pdq.com
Hi,
I'm not at work, will check it upon my return.
Thanks,
Ben
Build an E-Commerce Site with Angular 5

Learn how to build an E-Commerce site with Angular 5, a JavaScript framework used by developers to build web, desktop, and mobile applications.

reg query "HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome" /v DisplayVersion >> %youlogfile%

Open in new window



Would work too
Hi Michael,

I'm still waiting for that script to get fixed/completed.

Once that is done, I guess this will also get to work.

Thanks,
Ben
Hi,

When including the commands into the script, can you add the check for safari as well?

Thanks,
Ben
Sorry no Safari  here. I'd look for it like for Google browser under HKLM\Software...

https://docs.microsoft.com/en-us/windows/win32/msi/uninstall-registry-key
Thank you!
Hi Michael,

Tried the following

@Echo off

Cls
MD C:\SYSADMIT > NUL 2>&1
Echo. > c:\SYSADMIT\Resultados.txt
SET ListaEquipos=F:\conversion\temp\Listpcnames.txt

For /F %%z In (%ListaEquipos%) Do Call :Check %%z
goto :EOF

:Check
echo %1
echo %1  >> c:\SYSADMIT\Resultados.txt 
sc \\%1 config remoteregistry start= demand > NUL 
if %errorlevel% GTR 0 echo Unable to configure remoteregistry service %1 >> c:\SYSADMIT\Resultados.txt&Goto :EOF
SET COUNT=0
sc \\%1 start remoteregistry>NUL
:WaitLoop
	sc \\%1 query remoteregistry| find "RUNNING" > nul
	if %errorlevel% GTR 0 (
		Timeout 1
		SET /A COUNT+=1
		if %COUNT% LSS 10 goto :WaitLoop
	)
	if %COUNT% LSS 10 reg query "\\%1\hklm\Software\Microsoft\Internet Explorer" /v svcVersion >> c:\SYSADMIT\Resultados.txt
	if %COUNT% GEQ 10 echo Registry not accessible %1 >> c:\SYSADMIT\Resultados.txt

	if %COUNT% LSS 10 reg query "\\%1\HKLM\SOFTWARE\Mozilla\Mozilla Firefox /v CurrentVersion >> c:\SYSADMIT\Resultados.txt
	if %COUNT% GEQ 10 echo Registry not accessible %1 >> c:\SYSADMIT\Resultados.txt

	if %COUNT% LSS 10 reg query "\\%1\Program Files (x86)\Google\Chrome\Application\" /ad  /b >> c:\SYSADMIT\Resultados.txt
	if %COUNT% GEQ 10 echo Registry not accessible %1 >> c:\SYSADMIT\Resultados.txt



        sc \\%1 stop remoteregistry>NUL
goto :EOF

Open in new window


Getting error attached.

Thanks,
Ben
Untitled.png
This error is expected in case the queried key doesn't exist. probably the software isn't installed.

I'd change the code like this:
@Echo off

Cls
MD C:\SYSADMIT > NUL 2>&1
Echo. > c:\SYSADMIT\Resultados.txt
SET ListaEquipos=F:\conversion\temp\Listpcnames.txt

For /F %%z In (%ListaEquipos%) Do Call :Check %%z
goto :EOF

:Check
echo %1
echo %1  >> c:\SYSADMIT\Resultados.txt 
sc \\%1 config remoteregistry start= demand > NUL 
if %errorlevel% GTR 0 echo Unable to configure remoteregistry service %1 >> c:\SYSADMIT\Resultados.txt&Goto :EOF
SET COUNT=0
sc \\%1 start remoteregistry>NUL
:WaitLoop
	sc \\%1 query remoteregistry| find "RUNNING" > nul
	if %errorlevel% GTR 0 (
		Timeout 1
		SET /A COUNT+=1
		if %COUNT% LSS 10 goto :WaitLoop
	)
	if %COUNT% GEQ 10 echo Registry not accessible %1 >> c:\SYSADMIT\Resultados.txt & Goto :EOF
	reg query "\\%1\hklm\Software\Microsoft\Internet Explorer" /v svcVersion >> c:\SYSADMIT\Resultados.txt 2>nul
        if erorlevel 1 echo Internet Explorer not found >> c:\SYSADMIT\Resultados.txt

	reg query "\\%1\HKLM\SOFTWARE\Mozilla\Mozilla Firefox /v CurrentVersion >> c:\SYSADMIT\Resultados.txt 2>nul
	if errorlevel 1 echo Mozilla Firefox 64 bit not found >> c:\SYSADMIT\Resultados.txt

	reg query "\\%1\HKLM\SOFTWARE\WOW6432Node\Mozilla\Mozilla Firefox /v CurrentVersion >> c:\SYSADMIT\Resultados.txt 2>nul
	if errorlevel 1 echo Mozilla Firefox 32 bit not found >> c:\SYSADMIT\Resultados.txt

	reg query "\\%1\HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome" /v DisplayVersion >> c:\Sysadmit\Resultados.txt 2>nul
	if errorlevel 1 echo Google Chrome not found >> c:\SYSADMIT\Resultados.txt

        sc \\%1 stop remoteregistry>NUL
goto :EOF

Open in new window


It assumes the target is a 64 bit OS.

HTH
hi,

When running the previous code for internet explorer itself it worked.

Now when testing this, it started and when i looked back it was over.

This was the output.


0702192  
Unable to configure remoteregistry service 0702192
1106PC  

HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer
    svcVersion    REG_SZ    11.0.9600.19399

While list of pc's contains many.

Thanks,
Ben
I'm not in the office so I'm not able to test. I forgot the quotes after reg query Hklm.... Firefox before the /v

Please add them and re-test
I'd still recommend PDQ Inventory. It's agent-less, fast and inventories everything you require plus more. They have a trial version. It's even free after the trial period if you're willing to accept some limitations. No scripts involved..

Http://pdq.com
Hi,

Please add them and re-test
Now it stops immediately.

Thanks,
Ben
@Echo off

Cls
MD C:\SYSADMIT > NUL 2>&1
Echo. > c:\SYSADMIT\Resultados.txt
SET ListaEquipos=F:\conversion\temp\Listpcnames.txt

For /F %%z In (%ListaEquipos%) Do Call :Check %%z
goto :EOF

:Check
echo %1
echo %1  >> c:\SYSADMIT\Resultados.txt 
sc \\%1 config remoteregistry start= demand > NUL 
if %errorlevel% GTR 0 echo Unable to configure remoteregistry service %1 >> c:\SYSADMIT\Resultados.txt&Goto :EOF
SET COUNT=0
sc \\%1 start remoteregistry>NUL
:WaitLoop
	sc \\%1 query remoteregistry| find "RUNNING" > nul
	if %errorlevel% GTR 0 (
		Timeout 1
		SET /A COUNT+=1
		if %COUNT% LSS 10 goto :WaitLoop
	)
	if %COUNT% GEQ 10 echo Registry not accessible %1 >> c:\SYSADMIT\Resultados.txt & Goto :EOF
	reg query "\\%1\hklm\Software\Microsoft\Internet Explorer" /v svcVersion >> c:\SYSADMIT\Resultados.txt 2>nul
    if errorlevel 1 echo Internet Explorer not found >> c:\SYSADMIT\Resultados.txt

	reg query "\\%1\HKLM\SOFTWARE\Mozilla\Mozilla Firefox" /v CurrentVersion >> c:\SYSADMIT\Resultados.txt 2>nul
	if errorlevel 1 echo Mozilla Firefox 64 bit not found >> c:\SYSADMIT\Resultados.txt

	reg query "\\%1\HKLM\SOFTWARE\WOW6432Node\Mozilla\Mozilla Firefox" /v CurrentVersion >> c:\SYSADMIT\Resultados.txt 2>nul
	if errorlevel 1 echo Mozilla Firefox 32 bit not found >> c:\SYSADMIT\Resultados.txt

	reg query "\\%1\HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\Google Chrome" /v DisplayVersion >> c:\Sysadmit\Resultados.txt 2>nul
	if errorlevel 1 echo Google Chrome not found >> c:\SYSADMIT\Resultados.txt

     sc \\%1 stop remoteregistry>NUL
goto :EOF

Open in new window


typo: letter r missing in errorlevel at line right after IE query
This finally works,
Thank you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial