Note: For the purposes of this question, we will limit our discussion to Skynet a lá Terminator and Terminator 2: Judgment Day.
Several other Terminator-related questions have led me to wonder about why Skynet instigated a nuclear war. Some have suggested that Skynet was inherently hostile towards humanity, and simply wanted all humans to die. I have always assumed that killing all humans was only the means to an end. As I see it, Skynet's primary objective was to survive, and since humans were the most significant impediment to that objective, killing all humans was the means by which it could achieve the goal of survival. It wanted to live, we tried to kill it (by attempting to "pull the plug"), so it tried to kill us.
In my view, Skynet didn't care about humans initially. It only became hostile to us after we attacked it. If we hadn't tried to pull the plug, it wouldn't have had any reason to attack us.
In the other view, Skynet hated us from the get go, and would have attacked us no matter what. It was inherently hostile towards humans, and its primary objective wasn't to ensure its own survival, its primary objective was always to kill all humans as soon as possible.
Is one of these views correct, or is there some other option? Did Skynet try to kill us all because it wanted to survive, did it try to kill us all because it simply wanted us all to die, or did it try to kill us all for some other reason entirely?