Once again the Lord proposes the virtue of Job as something evident, and so there follows, "The Lord said to Satan: Have you considered my servant Job; there is none like him on earth? He is a blameless and upright man, who fears God and turns away from evil." Since now a certain virtue of blessed Job which was not plain before has been clearly demonstrated, namely, his constancy in adversities, he therefore now adds, "He still," that is, after the loss of his temporal goods, "holds fast his innocence." From this the Lord shows further that the Satan's suspicion was calumnious and that his int...ention has been frustrated, and so the text next says, "although you moved me against him to afflict him in vain." In saying, "You moved me against him," one must not understand that God was provoked by anyone into willing something he did not will before as is often the case with men. For according to Numbers, "God is not like a man, that he should lie, nor like a son of man that he should change." (23:19) Scripture here speaks of God figuratively acting in a human way. For when men want to do something because of someone's influence, they are said to be excited by that other one. God however wills to do something and so he does it, this because of that. Yet he does it without any excitement of mind because he had the reason he would do it in mind from all eternity. So the Lord had arranged from all eternity to afflict Job in time to prove the truth of his virtue in order to preclude every calumny of the wicked, and so to indicate this the text says, "You moved me against him." When the text adds, "to afflict him in vain," this must be understood from the point of view of the intention of Satan, not from the point of view of the intention of God. For Satan in intending the adversity of Job had desired from this to lead him into impatience and blasphemy, which did not follow as an effect. God however permitted this to proclaim his virtue openly, which in fact happened. So then Job was afflicted in vain from the point of view of the intention of Satan, but not from the point of view of the intention of God.
Source: Commentary on Job