command to run batch file in client automatiom CAE

I have batch file name autoexec.bat and want to run this batch to all client around 200
i try in ZCreate this command
NATIVE CMD /C "C:\temp\Autoexec.bat"
and also
CMD.EXE "C:\temp\Autoexec.bat"
all not working
please advice me to run this batch file
  • does the autoexec.bat file exist under C:\temp?

    have you also tried using the full path to cmd.exe? (i.e C:\windows\system32\cmd.exe)

    also why cant you just get it to execute "C:\temp\Autoexec.bat" (without using CMD?). do you need to use cmd.exe to execute it?

    if you want to hide the box from appearing you can use the hide.exe command (if required)
  • Hi Dets

    We have network printer and we want to install to all client
    We write batch file like

    rundll32.exe printui.dll,PrintUIEntry /in /n "\\dcysoft\dcprinter"

    to run the command as you said in CAE , I run C:\temp\autoexec.bat in the ZCREAT
    the batch run in the command ok it will install the printer as stand alone
    but from the CAE the command will run but will not install the printer
    I have attach screen shut for that
    Please help
  • checking your logs you provided, the logs show the "TESTPRINTER" service being removed from the machine? . can you provide logs of it trying to run and install on the machine? (want to see what errors come up)

    I have run the exact same command ("NATIVE CMD /C "C:\temp\Autoexec.bat") in my test environment and it appeared to try to install a printer.

  • Could it be that you're installing on the system account? Does this account have permission to \\dcysoft??
    And perhaps because it is installed under system account, you don't see a printer??
    Try another command in your batch file an check if this is working. Otherwise you should check the commands to install the printer.
  • Dear Det2
    I attach fresh log file for the agent if you need other log please let me now
    Hope this will help to find the problem
    By the way now after notify the client to the test print it will copy the autoexec.bat and nothing will appear to run the command only the first time after I create the program
  • Dear Musicmaker
    The CAE is Doman admin the client is user only , the user can access the \\dcysofy to install the printer
    I did not get what you mean by system account
  • the log files show the service being verified (and not installed). Can you firstly remove the service from policy, do a machine connect (so that the service is removed from the machine), then delete the log files and re-assign the service. Initiate another connection (so that the service is this time installed), then send me the logs.


    What musicmaker means is that, when a piece of software is normally being installed by CAE it uses the computers system account to install the software (and not the logged on user). So what might be happening is that its trying to execute the commands under the system account (in which it may not have permissions to access the network printer)

    you can try this by using the "at" command to create a scheduled task (which is run by the SYSTEM account). Create a scheduled task that opens a command prompt box (under the system account), then execute your command in this box.
  • in your screenshut i see that your batch file runs whith shell.try to rename your autoexec.bat to autoexec.cmd and it will be run in cmd.exe shell. when you run autoexec.bat manually it opens whith cmd.exe and works fine. i had similar problem with bat files.
  • I am currently work with Tariq on this issue.
    I want to highligh some points

    1- the Application and the command execute successfuly under the LocalSystem account which means for the LocalSystem account the printer object is created and stored under LocalSystem account profile.

    2- When we change the value of ZSYSACCT to N and still the zService Run under LocalSystem account.

    3- the args.xml is configured with $machine

    4- This problem can be solved if we assign the Packed to the User object in the active directory and populate the notify command with context=U, but the main issue that we want deploy this on computer bases.

    5- I found somewhere that this issue because of the notify service is running by LocalSystem account so all executions will be under LocalSystem, so I changed the Notify Service to run under my user and I notified that computer and It works, but I can not go to all computers and change the notify service to run under users.

    I tried to explain it clearly so other Ideas may be suggested.

    Mahmoud Ibrahim
  • Mahmoud,
    for good reason, all three HPCA Agent services (radsched, radstgms, radexecd) run under Local System account. While it is easily done to change the user account which the services run under to a domain user account (at least on a single machine), this is a severe change of the HPCA architecture with unforeseeable consequences for other packages, and will surely result in undesirable behavior.
    I strongly advise against changing the service user account to anything else but "Local System".

    Having said that, let's go back to your problem: you are trying to add a network printer queue. This can only be done by an interactively logged on user. The Local System cannot and should not do this.
    First: it would fail due to missing permissions of the Local System account in the domain.
    Second: the printer queue would only be visible to the Local System account, but not to any user.

    While I personally think that mapping print queues to users is not a job for the software distribution team, but more for the Active Directory administrator to manage in the Logon script, there are ways to do this via HPCA, as well:
    In order to achieve your desired results, I advise the following:
    * Change the service/package to become USER components, by flagging at least all FILE components with ZCONTEXT=U.
    * Deploy these components to a location which any user has write access to, e.g. FILE.LOCATION=&(ZNTUSER.ZUSERPRF)\Application Data\PrintQueues
    * Adapt the ZCREATE method accordingly to match the new file location.
    * Mark the ZSERVICE instance with the following attributes:
    * Make sure that all other services in SOFTWARE.ZSERVICE etc. are correctly flagged as
    ZSVCMODE=M: machine-only service
    ZSVCMODE=U: user-only service
    ZSVCMODE=MU: service with machine and user components
    * Run a user connect:
    radskman dname=SOFTWARE,context=U,uid=$MACHINE,cop=M,log=user.log
    * Make sure that every time you run a machine connect, the RADSKMAN command line includes the parameter "context=M", e.g.
    RADSKMAN dname=SOFTWARE,context=M,cop=Y,ver=N,log=software-dui.log
    * Please note: you cannot initiate a user connect by timer or by notification, because it would execute under Local System account. You need to start the user connect e.g. from a login script or from HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run.
    Hope this helps.