Group Policy is used to define user and computer configurations for groups of users and computer. There is a file called gpedit.msc to configure autoplay. This is useful to avoid viruses and malwares.
Step #1: So click on Start, and then click Run
Step #2: In the Open box, type gpedit.msc, and then click OK.
Step #3: Expand Computer Configuration > System > Turn of Autoplay (make sure you enable on all drives)
Step #4: Quit the group policy editor