It seems the most direct route is from Lvov to bratislava, for which I can't find schedules or timetables online, and then a short train from bratislava to Vienna that leaves every hour. I checked uz.gov.ua for information, but t doesn't recognize "bratislava" under destination.
Well, you need to look for this connection in a bit specific way
There is an
everyday direct through carriages from Moscow to Bratislava via Lviv (dep. from Lviv 21:14, arr. to Bratislava 14:05). However there are few obstacles against choosing this option: a) since it's a transit train, tickets from Lviv to Bratislava are difficult to obtain (it used to be that in advance wasn't possible at all, so passengers had to wait until before departure, which isn't very great idea); b) going via Slovakia geographically indeed shortest way, but it's not very cheap (one-way tariff between Ukraine and Slovakia aren't super good), plus in travel time going via Budapest is actually faster and you can be in Vienna already at 14
Another route could be through Budapest. Any suggestions?
Yep, going via Hungary is an option. You start from Lviv on the same 21:14 train (here there are Ukrainian carriages, so in advance ticket purchase is possible) and can arr. to Vienna either at 14 or 16 (for earlier arrival you'll have to make an extra train change). Going via Hungary (as well as via Slovakia) can be done rather cheaply in case you go for a small tariff trick - first purchase domestic Ukrainian ticket from Lviv to Chop (last Ukrainian station before Hungary/Slovakia), then short cross border ticket Chop-Zahony (in case you go via Hungary) or Chop-Cierna nad Tisou (for going via Slovakia) and then domestic Hungarian (Zahony-Budapest) or Slovak (Cierna-Bratislava) ticket.
Totally different option would be to go via Poland (Krakow-Katowice), meaning dep. from Lviv late evening and arr. to Vienna afternoon the next day. However here again you'll have to make couple changes + going via Poland is also not very cheap (mainly because of expensive Krakow-Vienna international ticket)