This paper is focused on the consensus problem of multi-agent systems via uncertain pinning control under switching topologies. The stochastic disturbances and randomly occurring nonlinearities are proposed to describe more realistic systems. The communication topology is modeled by a directed graph and it is divided into two cases, the consensus problem is discussed in these two cases. In addition, there exist some uncertain pinning connections between the followers and leader due to switching topologies, the distributed control protocol is designed to satisfy the follower asymptotically converge to the leader. By constructing suitable multiple Lyapunov functions and utilizing tools of M-matrix theory, some sufficient consensus criteria are deduced to reach this goal. Finally, two examples are given to verify the correctness of the proposed method.