Software Distribution Wizard - Deploying a batch file

(imported topic written by stephen.c.perez@lmco.com91)

this has given me a headache all night tonight… can someone assist? here is the email i sent to support:

I am using the Software Distribution Wizard to deploy a batch files to Windows 2003 servers, both 32 and 64 bit. I can manually run the batch file on the local server, and it runs fine, when I use the wizard to deploy, it does not work all the way through…. Here is the context of the batch file:

rem Stop Services

net stop sysedge

TIMEOUT /T 30

rem Delete Files

del /q c:\sysedge\config\sysedgeV3.cf

del /q C:\WINDOWS\system32\sysedge.cf

del /q C:\WINDOWS\system32\sysedge.mon

TIMEOUT /T 30

rem Copy Files

copy /y \prde2bfx001\SysedgeConfigFiles\sysedge.cf C:\WINDOWS\system32\

copy /y \prde2bfx001\SysedgeConfigFiles\sysedgeV3.cf c:\sysedge\config\

TIMEOUT /T 30

rem Start Services

net start sysedge

end

I have added timeouts, changed “CASE settings”, used “quotes”, almost everything I can think of… it does the c:\sysedge\config delete and copy command, but it will not do the commands that happen to be using the C:\WINDOWS\system32 path. Can you look this over and give me some more advice or something else to try?

Of course I need to get this done ASAP… as we are trying to implement SMNP V3 before the weekend.

Can anyone in this forum help me out?

(imported comment written by BenKus)

Hi Stephen,

I believe the issue will be with the copy commands from the share folder… The BigFix Agent runs as the SYSTEM account and thus does not have access to the same shares that you as a user have…

Generally there are two ways to move forward with this:

  1. Run the batch script as the currently logged in user using RunAsCurrentUser.exe tool found here:

http://support.bigfix.com/cgi-bin/kbdirect.pl?id=392

  1. Instead of copying the files from a share, add them to the software distribution wizard (put them in a folder and deploy them with the software distribution wizard and then add a few action script lines to copy the files). The lines you will add will look something like this:

// delete the files
delete c:\sysedge\config\sysedgeV3.cf
delete C:\WINDOWS\system32\sysedge.cf
delete C:\WINDOWS\system32\sysedge.mon

// copy the files from the __Download folder (they will be there after the extract is called) to the destination
copy __Download\sysedge.cf C:\WINDOWS\system32\sysedge.cf
copy __Download\sysedgeV3.cf c:\sysedge\config\sysedgeV3.cf

Hope that helps…

Ben

(imported comment written by stephen.c.perez@lmco.com91)

i see where your coming from… but i can get the copy command to work on the c:\sysedge\config directory just fine, but the del or copy command does not run/work on the c:\windows\system32, so to me, it seems like the copy command from the share is working ok, just not to he c:\windows\sysem32. I guess it could be a permission problem, but wouldnt the log tell me that? it states ran successfully… I looked into the runascurrentuser tool, how in the world does this work and where do i install it?

(imported comment written by BenKus)

Hey Stephen,

Unless your share is a null session share, then the copy won’t work.

To troubleshoot further, it would help if you posted your actionscript from the task you are trying to run, the batch file contents, and the log file from the agent… as well as what you see actually happen (which files being deleted? are they being copied?)

Ben

(imported comment written by stephen.c.perez@lmco.com91)

I have done some more testing…so here is the deal…

I can copy and delete files from everywhere on a windows server 2003 except from windows\system32… the custom task or software distribution wizard will not touch anything in sytem32… but it will in just the plain windows directory…

am i missing something here? runascurrentuser will not work for me… i need to make files deletes and copies to the windows\system32 folder, and i am not going to log into every server is have to make this happen.

is there anything else i can do? or am I out of luck?

(imported comment written by stephen.c.perez@lmco.com91)

the copies work from the share to the c:\sysedge\config folder but not to the c:\windows\system32, and here is the catch… the copy does work to c:\windows

(imported comment written by BenKus)

Is it a 32-bit or 64-bit OS?

Ben

(imported comment written by stephen.c.perez@lmco.com91)

i have a mixture of both… the current machine i am working with is: 64bit

(imported comment written by BenKus)

Ah… that could be the issue because of the way that the OS handles the 32bit vs. 64bit parts of the file system…

So your script is probably working but it is copying the files to the 32-bit system32 folder (which is actually at a subfolder of the 64-bit system called syswow64)… I bet if you check there you will see your files… I believe that the actual folder of “C:\windows\system32” that you are looking at in explorer is the 64-bit version of the file system folder.

If you want to use that folder instead, you need to tell the client to stop using the wow64 redirection, so you would put the line at the top of the action:

action uses wow64 redirection false

See if that helps,

Ben

(imported comment written by stephen.c.perez@lmco.com91)

BEN, I OWE YOU LUNCH!!!

thanks a TON… that was it…