Link to home
Start Free TrialLog in
Avatar of bfuchs
bfuchsFlag for United States of America

asked on

List PC Names and browser versions.

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
SOLUTION
Avatar of Brian B
Brian B
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bfuchs

ASKER

Hi,
I'm out of the office today.
will test & reply next week.
Thanks,
Ben
Avatar of bfuchs

ASKER

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
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
Avatar of bfuchs

ASKER

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
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"
Avatar of bfuchs

ASKER

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
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bfuchs

ASKER

Thank you!
Avatar of bfuchs

ASKER

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
Avatar of bfuchs

ASKER

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...
Avatar of bfuchs

ASKER

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.
Avatar of bfuchs

ASKER

Hi,
See attached.
Thanks,
Ben
Untitled.png
Can you test it manually using
sc \\server start remoteregistry
Avatar of bfuchs

ASKER

One it worked, the other one not, see attached.

Thanks,
Ben
Untitled.png
Avatar of bfuchs

ASKER

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?
Avatar of bfuchs

ASKER

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

Avatar of bfuchs

ASKER

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
Avatar of bfuchs

ASKER

Same thing.

Thanks,
Ben
I mean please post the screen content
Avatar of bfuchs

ASKER

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
Avatar of bfuchs

ASKER

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

Avatar of bfuchs

ASKER

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
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of bfuchs

ASKER

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
Avatar of bfuchs

ASKER

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