Batch File: Is ".NET" 2.0 or higher installed on remote PC

ReneGe
ReneGe used Ask the Experts™
on
Hi there,

I need a batch file that will tell me if a remote PC, has .NET 2.0 or higher installed.

Expected output: Yes or No

NOTE:
-I am domain admin
-All PCs are XP Pro

Thanks for your help,
Rene
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
save the following to a batch file (e.g. HaveDotNet2.cmd).
to run it from command line type HaveDotNet2 HOSTNAME or IP (e.g. HaveDotNet2 192.168.1.1)

it will return yes if installed and an error if not

@echo off

for /f "tokens=1" %%a in ('reg query \\%1\HKLM\SOFTWARE\Microsoft\.NETFramework\Policy\v2.0') DO if !%%a==!50727 echo yes

Open in new window

Author

Commented:
Thanks O.R.

Cheers,
Rene

Author

Commented:
FYI,

Here is my final script.


@echo off
SETLOCAL enabledelayedexpansion
SET MustUpdate=Yes
SET LogFile=%~n0.log
IF EXIST "%LogFile%" DEL /F /Q "%LogFile%"
FOR /F %%A in ('NET VIEW ^| Findstr -i "\\PC"') DO (
	ECHO QUERING %%A
	FOR /f "delims=" %%B IN ('reg query %%A\HKLM\SOFTWARE\Microsoft\.NETFramework\Policy ^| FINDSTR -i "v2 v3 v4 v5"') DO SET MustUpdate=No
	IF !MustUpdate! EQU Yes ECHO %%A>>"%LogFile%"
	SET MustUpdate=Yes
)

Open in new window

nice (-:
I'll remember that.

for me, for an application I'm writing, I wrote a small method in C# that returns true or false.

Author

Commented:
Thanks for the " nice (-: "

I am not a programmer, so I'm limmited to batch files.

Thanks again for helping me.Cheers

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