Solved

Using applescript to run "softwareupdate -ia" and the reboot.. anyone? :D

Posted on 2010-09-23
5
597 Views
Last Modified: 2012-05-10
Hi.

Does anyone have a applescript that wil run softwareupdate -ia and the reboot the mac?


0
Comment
Question by:ErikVest
  • 3
  • 2
5 Comments
 
LVL 33

Accepted Solution

by:
pgnatyuk earned 500 total points
Comment Utility
Seems like this article contains the full answer:
Apple Software Update options
http://managingosx.wordpress.com/2009/10/12/apple-software-update-options/
0
 

Author Comment

by:ErikVest
Comment Utility
Hi.

Well, it's embarrassing to write this but right after i was finish writing this question i found out the following command: softwareupdate -i -a;reboot. That solved it. But the page was good so i give yoy credit for that.


Best regards
 

 
0
 

Author Closing Comment

by:ErikVest
Comment Utility
Se the comment above.
0
 
LVL 33

Expert Comment

by:pgnatyuk
Comment Utility
yes. But it's bash. I think you need 'sudo'.
I thought you are looking for Applescript. I didn't want to make a wrapper for these two commands on my Mac now, it was not a good time to reset my computer, so I posted the link. :)
You are welcome.
0
 

Author Comment

by:ErikVest
Comment Utility
he he.. well it has to do with what i'm actually thinking about and what i manage to write down.. those two things is sometime not the same.. :D

But for further records i can post the applescript here:

tell application "Remote Desktop"
      set theScript to "softwareupdate -i -a; reboot" --build the command for
the Unix task
      set theTask to make new send unix command task with properties {showing
output:true, user:"root", script:theScript} --build the task

      set theClients to the selection
      if (length of theClients) = 0 then --no sense in whining, and with the
way Apple Remote Desktop works, I'm not sure this condition is possible,
so an empty selection fails silently
      else if (length of theClients) = 1 then
            try
                  display dialog "By default, ARD always selects the topmost computer in
a list. If this is the computer you want to upgrade, click the
\"Okay\" button"
                  --This is a warning I put in, because ARD *always* selects the first
client in a computer list, so while that avoids
                  --a problem with an empty selection, it can create a problem if you
don't notice that the wrong computer is selected
                  --i only ask this if a single computer is selected

                  set theTaskResult to execute theTask on theClients --run the task, save
the results

            end try
      else if (length of theClients) > 1 then
            set theTaskResult to execute theTask on theClients --run the task, save
the results
            --I use an else if, because I don't want any default that would run the
task outside of the specific desired situation
      end if
end tell

0

Featured Post

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Preface   In the first 100 days of the Macintosh release in January 1984, Apple sold 72,000 of the computers. Relatively cheap, easy-to-use personal computer with a graphical operating system. I've never seen this model. I did see this one:   …
Do you come here a lot? Are you lazy like me and don't want to go through the "trouble" of having to click your Dock's Safari icon and then having to click your Experts Exchange Favorites bookmark to get here? Well then this article is for you.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now