Installing Desktop Experience is simple. Following will do.
action uses wow64 redirection false
waithidden dism /online /enable-feature /featurename:DesktopExperience /norestart /all
continue if {exit code of action = 0 or exit code of action = 3010}
(need to restart after completion)
The detection is little more complex. Currently something like following works, but win32_serverfeature is deprecated and perhaps need a better way.
not exists selects "name from win32_serverfeature where id=35" of wmi