I am trying to install software with GPO at comptuer shutdown.
My first question is it is possible to do it with Software Install in Win2003 Server?
Then I tried to put a batch script to shutdown script of computer from GPO. Script is like that:
if exist c:\mydlp-0.7.12.txt goto end
echo %date% %time% >> c:\mydlp-0.7.12.txt
msiexec /i \\10.0.0.201\deploy\mydlp-endpoint-0.7.12.msi /qb /passive /forcerestart /l* C:\log.txt
:end
It does not install it on shutdown, it starts to install however it does not complete installation. However, when I run batch script normally it runs and installs software successfully.
Thanks in advance.
Best Answer
The specific problem you're having is that
MSIEXEC
, called in that manner, runs asynchronously. Run it with astart /wait msiexec ...
command and you'll get what you're looking for.Having said that, you're replicating a subset of functionality that's already built into the Group Policy client. You should research Software Installation policy to see what it can do for you. You can create a reasonably scalable, deterministic automated software installation environment without writing any scripts. It's not perfect but it does the job in a lot of cases. It'll also be much easier for The Next GuyTM to understand than a maze of batch scripts that you'll create this way.