If f(x) = x^3+ax+b is divisible by (x-1)^2 , then the remainder obtained by x+2 is
$$\begin{array}{ccl}x^{3}+ax+b & = &(x-1)^{2}(px+q)\\ & = & (x^{2}-2x+1)(px+q)\\ & = & px^{3}+(q-2p)x^{2}+(p-2q)x+q \end{array}$$
For equality, we need
$$p=1 \text{ and } q=2,$$
so
$$x^{3}+ax+b \rightarrow x^{3}-3x+2=(x-1)^{2}(x+2)$$
and the remainder after division by x+2 is zero.