AppleScript to disable annoying events

Hello!
I am developing a AppleScript to turn off -and on- some events that may cause problems or annoy while the program is running.
This is particulary convenient if you can not control the installation of the program or if the computer needs to be changed. I hope you find it useful
There are still some actions that may be improved. For example, I can not find a way of passing the password to those tasks related to auto login.
If somebody wants to collaborate, please go ahead!

#Apple Script to disable annoying events
#by Diego Mellado Martinez, Madrid, April 2015

#Set password
set PSWRD to "PASSWORD"

#Disables time to sleep
do shell script "pmset sleep 0" password PSWRD with administrator privileges

#Disables screen to sleep
do shell script "pmset displaysleep 0" password PSWRD with administrator privileges

#Disables disk to sleep
do shell script "pmset disksleep 0" password PSWRD with administrator privileges

#Disables screensaver
do shell script "defaults -currentHost write com.apple.screensaver idleTime 0"

#Disables software update
do shell script "softwareupdate --schedule off" password PSWRD with administrator privileges

#Disables WiFi
#a) Find your wifi id
set airPortDevice to do shell script "/usr/sbin/networksetup -listallhardwareports | awk '{if($3==\"Wi-Fi\"){getline;print}}' | awk '{print $2}'"
#b) Turn it off
do shell script ("/usr/sbin/networksetup -setairportpower " & airPortDevice & " off")

#Disables Bluetooth assitant for keyboard
do shell script "defaults write /Library/Preferences/com.apple.Bluetooth BluetoothAutoSeekKeyboard '0'" password PSWRD with administrator privileges
#Disables Bluetooth assitant for mouse
do shell script "defaults write /Library/Preferences/com.apple.Bluetooth BluetoothAutoSeekPointingDevice '0'" password PSWRD with administrator privileges

#Disables Crash Reporter
#do shell script "chmod 000 /System/Library/CoreServices/Problem\\ Repoter.app" password PSWRD with administrator privileges

#Disables Notification Center
#do shell script "defaults -currentHost write ~/Library/Preferences/ByHost/com.apple.notificationcenterui doNotDisturb -boolean true"
#do shell script "killall NotificationCenter"

#Enables autostart after power/cut
do shell script "pmset autorestart 1" password PSWRD with administrator privileges

#Enables AutoLogin
tell application "System Events"
    tell security preferences
        set properties to {require password to wake:false, require password to unlock:false, automatic login:true, log out when inactive:false, log out when inactive interval:0}
    end tell
end tell


#Hides the dock
tell application "System Events"
    tell dock preferences
        set properties to {autohide:true}
    end tell
end tell

#Sets a background -e.g. black background- located in Documents
tell application "Finder"
    set desktop picture to {"Macintosh HD:Users:User:Documents:black.jpg"} as alias
end tell

Relatedly, you might check out @NickHardeman’s ofxMacUtils which also handles OS configuration.

These are good resources as well:

Woah! Amazingly useful!
Thanks a lot for the info… too bad I did not find it before :smile:
Best,
Diego