List PC Names and browser versions.

bfuchs
bfuchs used Ask the Experts™
on
Hi Experts,
I am looking for a program that will list all PC names, browser names and versions within the network.
Would prefer it to be done either as a DOS command, batch file or VBA.
Thanks
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Brian BEE Topic Advisor, Independant Technology Professional
Commented:
You can query the IE version wit this command: reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v svcVersion

So you could use psexec to run that command against a list of systems:
psexec \\pcname -u username -p password -h cmd /c reg query "HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer" /v version

Open in new window


Obviously, this only lists the IE version. If there is another browser you want to know, you'll have to query it separately.

Hopefully that is a good start for you. Is there a reason you can't do this in Powershell? There's lots of examples out there in PS script.
Hi,
I'm out of the office today.
will test & reply next week.
Thanks,
Ben
Hi Brian,

Tried in both DOS and PS command prompt and getting attached error.

In addition I would need this to run against every PC on the network, how can it be done automatically?

And how can I add checking for other browsers as well?

Thanks,
Ben
Untitled.png
Microsoft Azure 2017

Azure has a changed a lot since it was originally introduce by adding new services and features. Do you know everything you need to about Azure? This course will teach you about the Azure App Service, monitoring and application insights, DevOps, and Team Services.

Brian BEE Topic Advisor, Independant Technology Professional

Commented:
Hi Ben,

psexec is used to run commands on other systems. <\\pcname> is a variable where you substitute the name of the PC. So basically, you need to create a batch file with one line for each PC (or a loop, depending on how comfortable you are with the programming scripts).

You can find more information here: https://docs.microsoft.com/en-us/sysinternals/downloads/psexec
Hi Brian,

Actually I found (after you had pointed me to the right direction...) the below doing exactly what I'm looking for.

https://stackoverflow.com/questions/3553984/how-do-i-detect-which-version-of-internet-explorer-is-installed

@Echo off

Cls

MD C:\SYSADMIT > NUL 

Echo. > c:\SYSADMIT\Resultados.txt

SET ListaEquipos=C:\SYSADMIT\ListaEquipos.txt

For /F "Tokens=*" %%z In (%ListaEquipos%) Do (

echo %%z  >> c:\SYSADMIT\Resultados.txt 

reg query "\\%%z\hklm\Software\Microsoft\Internet Explorer" /v svcVersion >> c:\SYSADMIT\Resultados.txt

)

Open in new window


The only problem I have is with the following...
It is also necessary to check RemoteRegistry service enabled on the target computers.


As if I have to manually go around and change things on all users PC's, then I minus well just check the version w/o the programming...

Any workaround?

Thanks,
Ben
Brian BEE Topic Advisor, Independant Technology Professional

Commented:
Ah, but you can do that remotely as well! Services can be set via policy. Or just include it in your script: "net start remoteregistry"
Hi Brian,

Looks like we're almost done...

I found the following
sc \\computername start remoteregistry

Open in new window


Can you tell me how to do it within the above script?
also would need to stop the service after running the reg query.

Thanks,
Ben
EE Topic Advisor, Independant Technology Professional
Commented:
Put it in before the reg query command and replace computername with %listaequipos%.
After the req query command do the same things with stop instead of start to turn the service back off.
Thank you!
Hi Brian,

Tested the following, and only showed pc names without any info.

@Echo off

Cls

MD C:\SYSADMIT > NUL 

Echo. > c:\SYSADMIT\Resultados.txt

SET ListaEquipos=F:\conversion\temp\Listpcnames.txt

For /F "Tokens=*" %%z In (%ListaEquipos%) Do (

echo %%z  >> c:\SYSADMIT\Resultados.txt 

sc \\%ListaEquipos% start remoteregistry

reg query "\\%%z\hklm\Software\Microsoft\Internet Explorer" /v svcVersion >> c:\SYSADMIT\Resultados.txt

sc \\%ListaEquipos% stop remoteregistry

)

Open in new window


What am I doing wrong?

Thanks,
Ben
Hi Brian,

Any idea?

Thanks,
Ben
sc start does'nt wait for a service to be started or stopped, so I assume it returns too fast to perform the reg query....
You need a loop

:
sc \\%ListaEquipos% start remoteregistry
:WaitLoop
sc query remoteregistry| find "STARTED"
if errorlevel 1 (
  timeout 1
  goto WaitLoop
)
reg query "\\%%z\hklm\Software\Microsoft\Internet Explorer" /v svcVersion >> c:\SYSADMIT\Resultados.txt
:

Open in new window

Same for stop if you want. Doen't really matter, will stop anyway...
Hi Michael,

Tried the following but didn't work,

@Echo off

Cls

MD C:\SYSADMIT > NUL 

Echo. > c:\SYSADMIT\Resultados.txt

SET ListaEquipos=F:\conversion\temp\Listpcnames.txt

For /F "Tokens=*" %%z In (%ListaEquipos%) Do (

echo %%z  >> c:\SYSADMIT\Resultados.txt 

:
sc \\%ListaEquipos% start remoteregistry
:WaitLoop
sc query remoteregistry| find "STARTED"
if errorlevel 1 (
  timeout 1
  goto WaitLoop
)
reg query "\\%%z\hklm\Software\Microsoft\Internet Explorer" /v svcVersion >> c:\SYSADMIT\Resultados.txt
:

)

Open in new window


Guess I'm missing how to combine what you posted with the original script.

Thanks,
Ben
My fault. New version:
@Echo off

Cls
MD C:\SYSADMIT > NUL 

Echo. > c:\SYSADMIT\Resultados.txt

SET ListaEquipos=F:\conversion\temp\Listpcnames.txt

For /F "Tokens=*" %%z In (%ListaEquipos%) Do (

	echo %%z  >> c:\SYSADMIT\Resultados.txt 

	sc \\%%z start remoteregistry
	:WaitLoop
	sc \\%%z query remoteregistry| find "STARTED"
	if errorlevel 1 (
	  timeout 1
	  goto WaitLoop
	)
	reg query "\\%%z\hklm\Software\Microsoft\Internet Explorer" /v svcVersion >> c:\SYSADMIT\Resultados.txt
)

Open in new window


Didn't really check. If there are any error messgaes just drop them here.
Hi,
See attached.
Thanks,
Ben
Untitled.png
Can you test it manually using
sc \\server start remoteregistry
One it worked, the other one not, see attached.

Thanks,
Ben
Untitled.png
Hi Michael,

Perhaps we should skip those with error messages for now, so at least those who are working should get recorded in file.

Thanks,
Ben
Hm, can you start the service locally on a system that throws error 1058?
Is it disabled?
Hi,

At the moment I don't need a complete list, just want find some computers using an old version and test it something from there.

How can we get this done ASAP.

Thanks,
Ben
@Echo off

Cls
MD C:\SYSADMIT > NUL 

Echo. > c:\SYSADMIT\Resultados.txt

SET ListaEquipos=F:\conversion\temp\Listpcnames.txt

For /F "Tokens=*" %%z In (%ListaEquipos%) Do (

	echo %%z  >> c:\SYSADMIT\Resultados.txt 

	sc \\%%z start remoteregistry
	SET COUNT=0
	:WaitLoop
	sc \\%%z query remoteregistry| find "STARTED"
	if errorlevel 1 (
	  timeout 1
	  SET /A COUNT+=1
	  if %COUNT% LEQ 10 goto :WaitLoop
	)
	if %COUNT% LEQ 10 reg query "\\%%z\hklm\Software\Microsoft\Internet Explorer" /v svcVersion >> c:\SYSADMIT\Resultados.txt
	if %COUNT% GTR 10 Registry not accessible %%z >> c:\SYSADMIT\Resultados.txt
)

Open in new window

hi,

Again results file is blank.

Thanks,
Ben
Blank? At least the 1st computer name should be written in it at line 12
remove the @echo off and rerun. Post the result
Same thing.

Thanks,
Ben
I mean please post the screen content
Attached.

Thanks,
Ben
Untitled.png
Would like to see what the batch writes to screen. If it scrolls to fast put a

pause

Before line 25
hi,

Nothing gets displayed it opens and closes immediately.

Is this working at your end?

Thanks,
Ben
Untitled.png
Sorry, didn't think about how strange a batch can react when nesting brackets...
Try this version please, it works on my end

@Echo off
Cls
MD C:\SYSADMIT > NUL 
Echo. > c:\SYSADMIT\Resultados.txt
SET ListaEquipos=F:\conversion\temp\Listpcnames.txt
For /F %%z In (%ListaEquipos%) Do (
	echo %%z  >> c:\SYSADMIT\Resultados.txt 

	SET COUNT=0
	Call :WaitLoop

	if %COUNT% LEQ 10 reg query "\\%%z\hklm\Software\Microsoft\Internet Explorer" /v svcVersion >> c:\SYSADMIT\Resultados.txt
	if %COUNT% GTR 10 Registry not accessible %%z >> c:\SYSADMIT\Resultados.txt
)
goto :EOF

:WaitLoop
sc \\%%z query remoteregistry| find "STARTED"
if errorlevel 1 (
	timeout 1 
	SET /A COUNT+=1
	if %COUNT% LEQ 10 goto :WaitLoop
)
goto :EOF

Open in new window

Still nothing, even tried adding few pauses as following, did not got to see anything.

@Echo off
Cls
MD C:\SYSADMIT > NUL 
Echo. > c:\SYSADMIT\Resultados.txt
SET ListaEquipos=F:\conversion\temp\Listpcnames.txt
For /F %%z In (%ListaEquipos%) Do (
	echo %%z  >> c:\SYSADMIT\Resultados.txt 

	SET COUNT=0
	Call :WaitLoop

	if %COUNT% LEQ 10 reg query "\\%%z\hklm\Software\Microsoft\Internet Explorer" /v svcVersion >> c:\SYSADMIT\Resultados.txt
	if %COUNT% GTR 10 Registry not accessible %%z >> c:\SYSADMIT\Resultados.txt
)
goto :EOF
pause

:WaitLoop
sc \\%%z query remoteregistry| find "STARTED"
pause
if errorlevel 1 (
	timeout 1 
	SET /A COUNT+=1
	if %COUNT% LEQ 10 goto :WaitLoop
pause
)
goto :EOF
pause

Open in new window


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% 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
        sc \\%1 stop remoteregistry>NUL
goto :EOF

Open in new window


No idea why last version showed results on my system but errors on your system..
Changed again and had results. Did some more logging and error handling
Also re-configured service Remoteregistry- It can be set to "disabled" on some systems.  I do not revert it to be "disabled" after the check
Hi Michael,

Great, this is finally working.

Now can you add those other browsers into this script, so I can finalize the other thread as well.

Thanks,
Ben
BTW, running this script logged in as admin against all computers on the network is safe?

Thanks,
Ben
It only queries one computer after the other so the impact should be nearly zero

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