Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Why not direct?' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Why not direct?
Authored by: jcbeckman on Sep 29, '09 08:37:17AM

set admin_password to "YourPassword"

do shell script "sudo networksetup -setairportpower off" password admin_password with administrator privileges

This works on 10.5 and 10.6, never tried it before that.



[ Reply to This | # ]
Why not direct?
Authored by: jcbeckman on Sep 29, '09 08:39:49AM

BTW, the only reason the password is separate is because I pulled these lines from a larger script where the password is used many times. You could get the password from a dialog box up front or just have the script prompt you if you want.



[ Reply to This | # ]
Why not direct?
Authored by: neier on Sep 29, '09 09:42:57PM
I think in 10.6, you need to name the network interface when you use networksetup. (And, if you are not logged in as an admin-capable account, you can also add the user name):
do shell script "sudo networksetup -setairportpower AirPort off" user name admin_username password admin_password with administrator privileges


[ Reply to This | # ]