Another “what should be a really easy task”, and Bigfix just can’t do it. I have a script that installs a piece of software and any prerequisite software it may need. The script is a batch file, and works great when run interactively (Bigfix can’t do it, though). Bigfix runs through the task and reports success with an exit code of 1 or 1619. There seems to be no pattern as to how each result is determined. Looking at the client, the software is not installed, and the script logging the results is empty. The log file buried in the Bigfix install install directory says nothing helpful. Big surprise there. Here’s the script I would like Bigfix to run. Keep in mind, I’m not a coder. I’m sure there is a better way to do this. I just don’t have all the time in the world to learn how.
@echo off
:CHKCPP
REG QUERY HKLM\SOFTWARE\Classes\Installer\Dependencies\{f65db027-aff3-4070-886a-0d87064aabb1}
IF %errorlevel%==0 (GOTO INSTALLCPP) ELSE (GOTO CHKVSTO)
:INSTALLCPP
echo "Installing Visual C++ 2013"
vcredist_x86.exe /Q
:CHKVSTO
REG QUERY "HKLM\SOFTWARE\Microsoft\VSTO Runtime Setup\v4R"
IF %errorlevel%==0 (GOTO INSTALLVSTO) ELSE (GOTO CHKDNF4)
:INSTALLVSTO
echo "Installing Visual Studio Tools for Office 2010"
vstor_redist.exe /q /norestart
:CHKDNF4
REG QUERY "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0\Client"
IF %errorlevel%==0 (GOTO INSTALLDNF4) ELSE (GOTO INSTALLPE)
:INSTALLDNF4
echo "Installing the .NET Framework version 4.0"
dotNetFx40_Full_x86_x64.exe /q
:INSTALLPE
echo "Installing PollEverywhere"
msiexec /i PollEverywherePowerPointAddInSetup.msi /quiet /qn /norestart /log c:\PollEverywhereInstall.log
GOTO END
:END
exit
Works great if I run it manually. I copied that script along with all of the executables up to Bigfix via the wizard. Here’s the action script I have now. The default script Bigfix provided didn’t work. It rarely ever does.
prefetch 7f9438764c961e2c5b99345ffc9fda7f18c0b679 sha1:7f9438764c961e2c5b99345ffc9fda7f18c0b679 size:130877829 http://server.domain.com:12345/Uploads/7f9438764c961e2c5b99345ffc9fda7f18c0b679/PollEverywhere.tmp sha256:e9fbc5881b656ea0804ced0d2e6860c387cc4dac45a15f8c4bb11e46d8bb4cca
extract 7f9438764c961e2c5b99345ffc9fda7f18c0b679
wait C:\Windows\System32\cmd.exe /c "{(pathname of client folder of current site) & "__Download\InstallPEwPreReq.bat"}" >> C:\ScriptResults.txt
I’ve been at this all day. I could be done by now, if I just RDP’d to every PC and ran the script manually, but I figured I’d give Bigfix another try.
Have you looked on the client after running the action?
When you action this all of the files should exist in the __Besdata/(site) – do you see your .tmp file and the batch script?
If you’re making a task then as long it gets to the end (which would happen basically no matter what because you are doing wait cmd.exe /c) it will report completion. If you want this to be something different you can change it under success criteria in the task or make it a fixlet instead.
On a related note – you are approaching this in a weird way.
Generally you would make the Install PollEverywhere it’s own fixlet with relevance that requires .Net, Visual Studio, and Visual C++ to be installed first using relevance. You’d also make fixlets for .net, Visual Studio Tools, and Visual C++. You could then put them all in a baseline together with Install PollEverywhere as the last item in the baseline.
Each fixlet really should be doing only one thing. I think the reason you’re having issues with Software Distribution is because of the complex tasks you are trying to do in individual tasks.
Jason, I was looking at your batch file logic and unless I’m missing something, the code for your dependencies seems to be backwards?
For each one I see that you make a reg query to a registry key that would exist if that package is already installed. So if that package is installed and that reg key exists, then the errorlevel will be set to 0 and you should skip past the install.
However, your code seems to be doing the opposite, where it actually tries the install if errorlevel is 0.
For example, shouldn’t this:
REG QUERY HKLM\SOFTWARE\Classes\Installer\Dependencies{f65db027-aff3-4070-886a-0d87064aabb1}
IF %errorlevel%==0 (GOTO INSTALLCPP) ELSE (GOTO CHKVSTO)
:INSTALLCPP
echo "Installing Visual C++ 2013"
vcredist_x86.exe /Q
:CHKVSTO
Be this?
REG QUERY HKLM\SOFTWARE\Classes\Installer\Dependencies{f65db027-aff3-4070-886a-0d87064aabb1}
rem reg key is there, so skip this install and move to CHKVSTO
IF %errorlevel%==0 GOTO CHKVSTO
:INSTALLCPP
echo "Installing Visual C++ 2013"
vcredist_x86.exe /Q
:CHKVSTO
I have looked on the client after the fixlet/task completed. The log files indicate everything ran successfully, and to Bigfix, they probably did. I had the MSI installer for PollEverywhere set a log file after completion. I use this to determine relevance for the PCs that don’t have PollEverywhere installed yet. That file is empty at the end of the task. I have the script Bigfix is running create a log file, so I have an idea what it did, or didn’t do. That’s where I’m informed the MSI file isn’t a valid MSI file, and that I should check with the vendor. The file is fine. It works when I run it manually.
I thought it would be easier this way. I shied away from making a fixlet for each prerequisite component because I cannot do the relevance to find them on the computer. That will take me weeks to figure out, if I even can at all. I do a similar thing when a program has a 32-bit and a 64-bit installer. I write a batch file like the one above and let it determine which version to install. Works great for Java, and other applications.
I’m not really sure. I’ve never found a clear tutorial on what is the best way to write a batch file. i just see what others have done and try to make it work for me.
You’ll need to approach this one step at a time. Start small and figure out what is working and what isn’t.
I’m specifically asking if the .tmp file in the fixlet that you are downloading is in one of the sites in __besdata on the client and if it’s contents are expanded out.
OK. I know you said you’re not a coder, but if you are writing or editing batch files and deploying software, you need to test them beforehand to make sure they work, right? Not to get all preachy but that’s your responsibility.
For example, on a machine that does not have this software installed (like mine), if you run REG QUERY HKLM\SOFTWARE\Classes\Installer\Dependencies{f65db027-aff3-4070-886a-0d87064aabb1} in a command prompt, you will get a message ERROR: The system was unable to find the specified registry key or value. If you then run echo %errorlevel% in that command prompt, you will get a 1 back.
If the software was already installed, meaning the reg key existed, you would not get an error and echo %errorlevel% would return a zero.
So in your batch file where you are testing if the errorlevel equals zero, that means you can skip that install and move to the next one.
Before you delve into why BigFix is not working, you need to be sure that your script is really working the way you thought it was.
The script does work, if I run it interactively. It goes through each step and installs/ignores what’s necessary and finishes off with PollEverywhere. I always test my scripts and action commands thoroughly before going to Bigfix. That’s SOP. Bigfix hardly works when I do test beforehand. I don’t expect it to work with stuff I haven’t tested. Every command that looks for something, and installs something else was tested individually before it was wrapped up in the larger script. They all work, just not when I place them into Bigfix. I’ll give the idea of creating a fixlet/task for each component and using a baseline to install. Just not sure how I’ll handle the relevance. That’s the hardest part for me.
Hey Jason, you can also try taking out the batch file from the package and copying the batch file code into the actionscript itself within the createfile until _end_/_end_ piece and see if that changes anything. Plus, if you need to tweak the batch code, you don’t have to re-upload it through the wizard again. Not sure what this will produce, but hopefully it will give you better visibility, maybe add some echos to a file in your batch to make sure it is doing what you think it is. Then, if the batch is working and the MSI is tanking, you can add verbose logging to that if need be. Hope some of this might be helpful.
A big difference between running something interactively and running it as the agent is the user that is running it. The agent runs the action as LOCAL SYSTEM and not a regular user. Some installer packages have issues which is why we offer the ability to run as the current logged on console user.
Jason, I know you are wary of the relevance, and believe me I know relevance can get into hair-pulling territory. But you may not realize that you pretty much already have the relevance with your registry checks in the batch file.
I built a baseline to test since as @strawgate mentioned it’s the “right” way to do things, and I was able to install your prerequisites and PollEverywhere successfully. Like he said, just use the Software Distribution Dashboard to upload and create tasks for each app individually. Then use the registry keys to add to the default relevance for each of those packages:
For the VS 2013 redistributable:
not exists keys "HKLM\SOFTWARE\Classes\Installer\Dependencies\{f65db027-aff3-4070-886a-0d87064aabb1}" of (x32 registries; x64 registries)
For the VS 2010 Office Runtime 4.0:
not exists keys "HKLM\SOFTWARE\Microsoft\VSTO Runtime Setup\v4R" of (x32 registries; x64 registries)
For .NET 4.0:
not exists keys "HKLM\SOFTWARE\Microsoft\NET Framework Setup\NDP\v4.0\Client" of (x32 registries; x64 registries)
For the Poll Everywhere relevance, include the previous relevance statements (but remove the “not” from the beginning, because you only want to install Poll Everywhere if the keys do exist) and add this one:
not exists keys "{D8EBE20F-0EDA-4AC2-8A3A-C3DD9CDE289F}" whose ( value "DisplayVersion" of it as string as version >= "1.6.12" as version) of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of (x32 registries; x64 registries)
So the Poll Everywhere relevance ends up like this:
Here’s the fixlet. Exported, and opened with Notepad++
<?xml version="1.0" encoding="UTF-8"?>
<BES xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="BES.xsd">
<Task>
<Title>Software Distribution - Deploy Poll Everywhere Powerpoint Add-In</Title>
<Description><![CDATA[This task will deploy: Poll Everywhere Powerpoint Add-In.<BR><BR>This task is applicable on: Windows 7, Windows 7 x64, Windows 8, Windows 8 x64, Windows 8.1 and Windows 8.1 x64. ]]></Description>
<Relevance>((name of it = "Win7" AND NOT x64 of it) OR (name of it = "Win7" AND x64 of it) OR (name of it = "Win8" AND NOT x64 of it) OR (name of it = "Win8" AND x64 of it) OR (name of it = "Win8.1" AND NOT x64 of it) OR (name of it = "Win8.1" AND x64 of it)) of operating system AND (not exists file "C:\PollEverywhereInstall.log ")</Relevance>
<Relevance><![CDATA[exists regapp whose (name of it as lowercase = "powerpnt.exe" as lowercase and version of it >= "14" as version)]]></Relevance>
<Category>Software Distribution</Category>
<DownloadSize>130877829</DownloadSize>
<Source>Software Distribution Wizard</Source>
<SourceID></SourceID>
<SourceSeverity></SourceSeverity>
<CVENames></CVENames>
<SANSID></SANSID>
<MIMEField>
<Name>x-fixlet-source</Name>
<Value>Software Distribution Wizard</Value>
</MIMEField>
<MIMEField>
<Name>x-fixlet-modification-time</Name>
<Value>Thu, 21 Jan 2016 19:41:45 +0000</Value>
</MIMEField>
<Domain>BESC</Domain>
<DefaultAction ID="Action1">
<Description>
<PreLink>Click </PreLink>
<Link>here </Link>
<PostLink>to initiate the deployment process.</PostLink>
</Description>
<ActionScript MIMEType="application/x-Fixlet-Windows-Shell"><![CDATA[prefetch 7f9438764c961e2c5b99345ffc9fda7f18c0b679 sha1:7f9438764c961e2c5b99345ffc9fda7f18c0b679 size:130877829 http://iemserver.domain.com:12345/Uploads/7f9438764c961e2c5b99345ffc9fda7f18c0b679/PollEverywhere.tmp sha256:e9fbc5881b656ea0804ced0d2e6860c387cc4dac45a15f8c4bb11e46d8bb4cca
extract 7f9438764c961e2c5b99345ffc9fda7f18c0b679
wait C:\Windows\System32\cmd.exe /c "{(pathname of client folder of current site) & "__Download\InstallPEwPreReq.bat"}" >> C:\ScriptResults.txt
]]></ActionScript>
<SuccessCriteria Option="RunToCompletion"></SuccessCriteria>
</DefaultAction>
</Task>
</BES>
The log file does show all steps of the fixlet running. I can’t see if the TMP file has been extracted to the location you specified. I can try running the batch file from the extracted TMP file.
If you dont see the TMP file and you don’t see the TMP file contents in a __Download folder in one of the sites in __BESData you have much bigger issues. The files being on the client are the first thing you need to verify.
Only once you’ve confirmed the files exist on the client and are correctly extracted can you then test the .bat file.
You need to let the bigfix client put the .bat on the endpoint and then test that batch file – testing the batch file you’ve already got doesn’t prove anything.
Your relevance had some issues. I fixed them in the text. key needed to be pluralized to keys if it is going to reference (x32 registry; x64 registry)
Also, (x32 registry; x64 registry) should be pluralized to (x32 registries; x64 registries) so that it will work on 32bit systems without throwing an error. I didn’t make this change.