PDA

View Full Version : PSEXEC to run .Bat File


kblaine
09-08-2005, 10:01 AM
I am trying to run a batch file on a particular server, but it only works 1/3 of the time.

Here is what my VB step is:
psexec %server_name% -u domain\username -p mypassword -i c:\WEB_inst.bat

Here is the error I get 2/3 of the time:
The process tried to write to a nonexistent pipe.
Connecting to server_name..Starting PsExec service on server_name Connecting with PsExec service on Server_name Starting C:\WEB_inst.bat on Server_name..
C:\WEB_inst.bat exited on Server_name with error code 1.
Process completed with exit code 1

The batch script that I run, places approximately 100 assemblies into the GAC. Here is the line that is used in the bat file, multilplied by 100:
C:\gacutil -i C:\na33.2003\Infragistics.UltraChart.Core.v3.dll

Do you know of an easier way to automate installing 100 assemblies into the gac? Why is my build only working 1/3 of the time, and getting "the process tried to write to a nonexisitent pipe" the rest of the time?

Thank you!

kinook
09-08-2005, 11:17 AM
Regarding the batch file problem, it seems that PsExec has trouble sending a batch file's output to the pipe VBP creates (not sure if the problem is with VBP or PsExec, but we'll look into it). You can work around the problem by either

1) configuring the step to read output from None

or

2) configuring the step to read output from A file (%server_name%\c$\output.txt) and redirecting the batch file's output to that file (psexec %server_name% -u domain\username -p mypassword -i cmd /c c:\WEB_inst.bat > c:\output.txt)

One way to automate installing a bunch of assemblies into the GAC would be to build a VBP project on the remote computer that uses a Process Files + GAC Install action. Another option would be to use a FOR loop in your batch file (type for /? at a Command Prompt to see the available syntax).

kblaine
09-08-2005, 01:47 PM
Perfect thank you! Setting the output to none helped, though it would be nice to see the output in my build log file. But works, so I am happy.

I am looking into the for loop on my batch file. Thank you for the quick response!!

kblaine
09-08-2005, 03:15 PM
I am trying the following, but GACUTIL always needs one argument, like an assembly name. Know how to get around this? It doesn't seem to like wildcard characters.


D:\>FOR %v IN (D:\*.dll) DO Gacutil /I

D:\>Gacutil /I

Microsoft (R) .NET Global Assembly Cache Utility. Version 1.0.2914.16
Copyright (C) Microsoft Corp. 1998-2001. All rights reserved.

Option -I takes 1 argument

D:\>

kinook
09-08-2005, 03:39 PM
FOR %v IN (D:\*.dll) DO Gacutil /I %v

kblaine
09-09-2005, 08:50 AM
Dang.. :) thanks!

So I have it all working successfully!

FOR /R D:\Infragistics\ %v IN (*.dll) DO D:\Infragistics\Gacutil.exe /I %v

Though I am still having troubles with the output. If I output to a file, it doesn't get written there. If I put standard output, it only works 1/3 of the time.

Thank you for the quick assistance on this. If you find a fix for the output, please post.

cheers.