What do the guards want to do or know about the ghost in Hamlet?
You already have good answers to your question but maybe I can a bit more food for thought with the following.
The main thing the guards want to DO is to get a "scholar" to give an opinion on whether the ghost is the dead King Hamlet, young Hamlet's father. The thing they want to KNOW is what communication the ghost wants to make. They want to communicate with the ghost to see if it will identify itself and tell them what it wants. Barnardo proclaims that it is there intentionally to be spoken to apparently for the purpose of giving some important information:
BERNARDO: It would be spoke to.
Since the three guards are just guards and not educated in how to discourse effectively with scholar kings of high estate (station, position in life), they need someone who is experienced in such things to help them out and actually try talking to the ghost. Sadly they are disappointed, and must have been disappointed in Horatio, because the ghost does not answer him but "stalks" away as in a fit of temper. Marcellus says: "It is offended."
Some critics suggest that there is within Hamlet a theme of Catholicism versus the new Reformation Protestantism. Horatio's command,
"By heaven I charge thee speak!"
may illustrate the theme of the rift between Catholics and Protestants. Catholics held that only priests had authority to command spirits and ghosts. Protestants believed that no one comes between a Christian and God and so every Christian has the authority that Catholics believed was held only by priests. Since King Hamlet was old, it is reasonable to think he kept a hold of his Catholic religion. Since Horatio is young Hamlet's friend and since Hamlet was educated at a Protestant Reformation university in Wittenburg, it is reasonable to suppose that Horatio and Hamlet have become Protestants and given up Catholicism. This might explain why the ghost stalked away as if offended: he was ticked off that a Protestant was giving him orders a priest should give.
Having said the above, that may be another part of what the guards wanted: They wanted someone who had authority to speak with ghosts and spirits to come and communicate with the ghost because superstition indicated that it might be dangerous to address a ghost without having the authority to do so. And to reiterate, for a Catholic, the person with authority to talk to ghosts would be a priest, for a Protestant, the person would be any Protestant believer in Christ.
As the play begins, up on a platform of the Elsinore castle, in the dark cold of night, Marcellus and Bernardo stand watch. They have asked Horatio, Prince Hamlet's good friend, to join them because for two nights they have seen a ghost that looks just like the prince's father. They are waiting in the bitter cold for the ghost to appear again. They think that if it really is Hamlet's father's ghost, it is well that Hamlet be told about it.
At first, Horatio is dubious; he doesn't believe what they tell him and certainly doesn't think it will appear again, whatever it was. But then....
Enter the Ghost.
Peace! break thee off! Look where it comes
In the same figure, like the King that's dead.
Thou art a scholar; speak to it, Horatio.
Looks it not like the King? Mark it, Horatio.
Most like. It harrows me with fear and wonder.
It would be spoke to.
Question it, Horatio.
What art thou that usurp'st this time of night,
Together with that fair and warlike form
In which the majesty of buried Denmark
Did sometimes march? By heaven I charge thee speak!(60)
It is offended.
See, it stalks away!
So much for Horatio's practical skepticism. Soon he will tell Hamlet what he has seen, and the next night Hamlet and the ghost will meet for the first time.
In the first scene of the play, four guards are on the castle battlements. They are there to look for the ghost, which two of them have seen previously. The men are Francisco, Bernardo, Marcellus and Horatio.
When they see the ghost, the first thing they want to do is to have Horatio go talk to it. They don't try that in time, and the ghost disappears. When it comes back, Marcellus tries to hit it with his partisan. That doesn't work either and the ghost disappears again. After that, they just decide that they'll tell Hamlet about it the next day.