Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 554
  • Last Modified:

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

0
ReneGe
Asked:
ReneGe
  • 8
  • 4
2 Solutions
 
Bill PrewCommented:
Where do you see the error code?  Can you tell if the setup.exe program actually gets started on the remote PC, or not?

~bp
0
 
ReneGeAuthor Commented:
I see the error code on screen
Also in the log file
@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
	SET Result=!errorlevel!
	IF !Result! NEQ 0 (ECHO %%A FAILED [!Result!]>>%~n0.log) ELSE (ECHO %%A SUCCESS>>%~n0.log)
	RD /S /Q "!Destination!"
)

PAUSE

Open in new window

0
 
Bill PrewCommented:
Does this happen for all computers in the list file, or just some?

Have you tried executing just the psexec from a command line?

Does the setup program actually run on the remote?

Have you tried running some other program like notepad?

~bp
0
What Kind of Coding Program is Right for You?

There are many ways to learn to code these days. From coding bootcamps like Flatiron School to online courses to totally free beginner resources. The best way to learn to code depends on many factors, but the most important one is you. See what course is best for you.

 
ReneGeAuthor Commented:
Yes to all

Thanks,
Rene
0
 
Bill PrewCommented:
Not sure then, you running the latest PSEXEC, I read that there were some quirks with the errorlevel in early versions.

~bp
0
 
ReneGeAuthor Commented:
I'll look at it. Will let you know.

Thanks
0
 
Adam LeinssSenior Desktop EngineerCommented:
Not much more to offer, but you could try PSEXEC -s -i %%A which uses the LOCALSYSTEM to do the install and -i for interactive to allow it access to the desktop environment.
0
 
ReneGeAuthor Commented:
==>aleinss

Thanks, did'nt think of that one.

I'll test and come back!

Cheers,
Rene
0
 
ReneGeAuthor Commented:
==>aleinss

Still does not work

Thanks for your contribution

Cheers,
Rene
0
 
ReneGeAuthor Commented:
==> billprew

My version was 2008. I updated it and still same problem.

I can't put more time on this so I'll close this threar and distribute points considering the level of contribution.

Thanks guys,
Rene
0
 
ReneGeAuthor Commented:
If you have any further odeas, would you mind sharing?

Thanks and cheers,
Rene
0
 
Bill PrewCommented:
Rene,

Thanks for the credit, sorry I wasn't more help on this one.

~bp
0
 
ReneGeAuthor Commented:
It' cool Bill!

Cheers,
Rene
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 8
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now