SCCM ERROR!!!!!!!!!!!!

I am simply trying to run a batch file as a program within a package and advertise that to some systems. The batch file is supposed to uninstall an older application and then install the newer one using its .msi package. I try to do this and I get the following error every time under the Advertisement System Status location in SCCM:

============================================================================
A failure exit code of 1 was returned.
User context: NT AUTHORITY\SYSTEM

Possible cause: Systems Management Server (SMS) determines status for each program it executes. If SMS cannot find or correlate any installation status Management Information Format (MIF) files for the program, it uses the program's exit code to determine status. An exit code of 1 is considered a failure.
Solution: For more information on the exit code, refer to the documentation for the program you are distributing.
=============================================================================

Also, here is the code I am trying to use in my batch file:
REG QUERY HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\FFD0D1F8C889BA64A87750A079B96B05\InstallProperties /v DisplayVersion | Find "DisplayVersion      REG_SZ  7.5.087"

If %ErrorLevel%==0 goto Exist

If %ErrorLevel%==1 goto Not_Exist

:Exist

msiexec.exe /x "\\myUNClocation\old.msi" /qn

msiexec.exe /i "\\myUNClocation\new.msi" /qn /norestart

:Not_Exist

Exit

Open in new window

kulisnccAsked:
Who is Participating?
 
merowingerCommented:
1. Uninstall the Application with the Windows Installater Product GUID and not the Filename
msiexec.exe /x "{XYZ.....}" /qn

2. Copy the batch file and the new.msi into the new package and then start the batuch in the program paramaters with the following command:
cmd /v yourbatch.bat
and tht installation of the msi wit the following command
msiexec.exe /i new.msi /qn /norestart
(As the msi is in the same path then you don't need to define it

Make sure the EXISTS section gets executed. For example create a Logfile with the following command
echo "yes its executed" > C:\did_run.txt
REG QUERY HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Installer\UserData\S-1-5-18\Products\FFD0D1F8C889BA64A87750A079B96B05\InstallProperties /v DisplayVersion | Find "DisplayVersion      REG_SZ  7.5.087"

If %ErrorLevel%==0 goto Exist

If %ErrorLevel%==1 goto Not_Exist

:Exist
echo "yes its executed" > C:\did_run.txt

msiexec.exe /x "{XYZ....}" /qn

msiexec.exe /i "new.msi" /qn /norestart

:Not_Exist

Exit

Open in new window

0
 
kulisnccAuthor Commented:
I will try that, but I have a question. Why is it that it uninstalls the program referencing the msi file when I run it manually? For instance, this actually works:

msiexec.exe /x "\\myUNClocation\old.msi" /qn

but you are saying that if running as a logon script then reference the programs GUID instead?
0
 
kulisnccAuthor Commented:
By the way, my data validation is running i already tested that before posting here (%errorlevel1%). Thanks though.
0
 
kulisnccAuthor Commented:
the uninstall works with the GUID, thanks
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.

All Courses

From novice to tech pro — start learning today.