Login to your Raspberry Pi via Putty
Edit the config.txt file
sudo nano /boot/config.txt
Add the following lines to the end of your config.txt file:
#Shutdown Buttondtoverlay=gpio-shutdown,gpiopin=3#Poweroff Triggerdtoverlay=gpio-poweroff,gpiopin=4
Save your changes
sudo reboot