Avatar of ReneGe
ReneGe
Flag for Canada

asked on 

Batch File: "Port Reporter" Remote installation

Hi there,

I did this batch file to install Port Reporter on all PCs on my network.

Everything in this script works, but the installation fails with an error code 1.

By the way, I am a Domain Admin.

Could you please tell me what I did wrong?

Thanks for your help,
Rene
@ECHO OFF

SETLOCAL ENABLEDELAYEDEXPANSION

FOR /F %%A IN ('net view ^| findstr \\PC') DO (
	ECHO %%A
	SET Destination=%%A\c$\Temp\PortRptr
	IF NOT EXIST "!Destination!" MD "!Destination!"
	COPY ".\PortRptr" "!Destination!"
	PSEXEC %%A C:\Temp\PortRptr\pr-setup.exe /a /s
	IF !errorlevel! NEQ 0 (ECHO %%A FAILED>>%~n0.log) ELSE (ECHO %%A SUCCESS>>%~n0.log)
	RD /S /Q "!Destination!"
)

PAUSE

Open in new window

Windows BatchNetworkingMicrosoft DOS

Avatar of undefined
Last Comment
ReneGe

8/22/2022 - Mon