XPS Viewer fixlet - gosh darn dang thing won't work

I am trying to use the following fixlet to enable the Windows Optional Feature XPS Viewer,


The first issue I’m seeing is with the relevance associated with this fixlet. If I leave the default relevance in place I get exactly zero machines showing up as Applicable:

exists file “dism.exe” of system folder

if( name of operating system starts with “Win” ) then platform id of operating system != 3 else false

if exists property “in proxy agent context” then ( not in proxy agent context ) else true

exists file “DISM.txt” of parent folder of client

exists lines whose (it contains "Xps-Foundation-Xps-Viewer " and it contains “Disabled”) of file “DISM.txt” of parent folder of client

If I remove all the relevance except “exists file dism.exe of system folder” I will finally get some relevant computers showing up.

Once I get this far and try to deploy the fixlet it fails, upon examining the action script I found this

action uses wow64 redirection {not x64 of operating system}
delete __appendfile
appendfile “{pathname of system folder}\dism.exe” /online /enable-feature /featurename=Xps-Foundation-Xps-Viewer
appendfile “{pathname of system folder}\dism.exe” /online /get-features /format:table > "{pathname of parent folder of client}\DISM.txt"
delete __Download\dism.bat
move __appendfile __Download\dism.bat
waithidden __Download\dism.bat

My question is what is the dism.bat? Is that something I’m supposed to create? I also wonder if the argument for the switch /online /enable-feature /featurename=Xps-Foundation-Xps-Viewer is correct. It does not match what I find in other site to use to install XPS viewer from the command line. */Online /Add-Capability /CapabilityName:XPS.Viewer~~~~* Which is what I’ve used to succesfully install it while sitting at the desktop.

P.S. I’m pretty new to BigFix and winging some of it.

Welcome to BigFix! I’ll see if I can help clear some of it up.
The Fixlets at BigFix.me are submitted by anyone in the BigFix community, and sometimes they can get a bit dated.

As to the relevance on this one…

exists file "DISM.txt" of parent folder of client
That file won’t exist by default. It’s likely the author of this fixlet also has some related Task that would use the dism command line to create this file, which they then parse in the relevance for this fixlet (and probably other fixlets they posted as well).

As to the action script and the dism.bat file…this Fixlet is creating that batch file on-the-fly.

delete __appendfile

This removes the file named “__appendfile” on the client, if there is one there already; it’s important to delete the file so we can start with a fresh one.

appendfile “{pathname of system folder}\dism.exe” /online /enable-feature /featurename=Xps-Foundation-Xps-Viewer

The ‘appendfile’ command creates or updates the file named “__appendfile” and adds one line to it. In this case it will be a new __appendfile with the dism.exe command line in it.

appendfile “{pathname of system folder}\dism.exe” /online /get-features /format:table > "{pathname of parent folder of client}\DISM.txt"

This second command line gets appended to __appendfile. Looks like it would regenerate the dism.txt file with the new package list, which should now include the XPS package. If the relevance was working, this lets the relevance check that XPS has actually been successfully added.

delete __Download\dism.bat

If the disk.bat file existed, this would remove it. It’s important because when we use the ‘copy’ or ‘move’ commands, they will fail if the target file already exists (the command will not overwrite an existing file).

move __appendfile __Download\dism.bat

This moves the ‘__appendfile’ that we just created to the dism.bat file.

After that it uses cmd.exe to execute the batch file.

So, if the package name is wrong (maybe that package name was for an earlier version of Windows), just change the first appendfile command to reference the new name of the package.

And probably find the author’s other task, the one that builds the disk.txt output to begin with, and action that first so you can go back to using real relevance on this fixlet.