Historically, hopefully meant in a hopeful manner and was not to be used like the German hoffentlich (i.e., as a synonym for I hope or let’s hope). The word’s latter, newer sense, which has been around since at least the 1960s (when it was considered taboo in writing), is now accepted in The Associated Press Stylebook and in colloquial American English, where it appears with such abundance that any fight against this linguistic change is moot. If you do use hopefully in your writing, do not use it ambiguously: John will hopefully come home can mean that John is hopeful he will return home or that the speaker is hopeful that John will return home. Better alternatives might be We hope John will come home or John hopes he will come home.
Despite its prevalence in colloquial English and acceptance in journalistic English, avoid this word in formal writing. Used correctly, it may still pause a reading, especially for usage experts who assume its use is incorrect; used incorrectly, it will lower the writer’s credibility among careful readers. Whatever you do, do not use It’s to be hoped, a prolix, passive alternative.