First of all go to Start Menu then Run and type
gpedit.msc
press enter
gpedit.msc
press enter
Here you see Group Policy Window .then select Administrative Templates and then System as the from
above picture.You will see an item in the right side pane called " Turn off Autoplay".
Double click the item , and set the radio button to Enabled and change the "Turn off Autoplay on"
to All Drives.