Home › Forums › OS X Server and Client Discussion › Misc. › Re-run Login Items after you have logged in?
- This topic has 3 replies, 2 voices, and was last updated 17 years, 1 month ago by
khiltd.
-
AuthorPosts
-
March 10, 2008 at 7:19 pm #371844
dds
ParticipantIs there a way to re-run Login Items at a later time after someone has already logged in?
Short story:
I have mobile users who are managed with MCX. Most users have specific network volumes mounted at login as Login Items in WGM. Works great when the Mac users are on my LAN, but of course it doesn’t work when those same users take their laptops off the LAN when they travel.
Most of my mobile Mac users use a Cisco VPN solution to get back into my LAN as needed from the road. Id like to write a user-friendly script or app (i.e.; double-clickable icon) to re-run their MCX login items policies and mount their network volumes over the VPN.
Long story:
My Mac users get all their network volumes mounted at login time via MCX policies (which are AD groups nested in OD groups). Each Mac user automatically mounts certain network volumes at login time based on which AD groups they are in (managed in WGM). For example:
Employees in our Imaging lab get the Imaging lab volumes, likewise employees in the Art Dept get the Art Dept volumes, etc. I’m basically mimicking the Windows paradigm of “mapping drives” – if you know what I mean.
My problem is that many of my Mac users have laptops. Obviously these users dont have 24/7 access to the corporate network file servers when they are on the road unless they connect to the LAN via VPN. Which leads me on my mission of finding a solution for when they VPN into my LAN from the road: Id like a way to re-map those network volumes for them in a simple, fast manner.
Is it possible to re-run Login Items such as the mounting of network volumes?
March 11, 2008 at 2:59 pm #371850khiltd
ParticipantLogin items have always been accessible through AppleScript, and in 10.5, there’s a C API as well (previously you had to parse the plist manually). Look in the “System Events” dictionary for the “Login Items Suite” for the AS solution or in LSSharedFileList.h for C.
But rather than using login items at all, you should probably register for SystemConfiguration notifications and use the network reachability API to determine when these resources become available; that way everything will happen automatically.
March 17, 2008 at 5:28 pm #371908dds
ParticipantI have been able to get AppleScript to talk to System Events and provide me with a list of current login items. Its a simple script to show me what items are currently considered login items. This would be a good starting place for my project.
Unfortunately, it wont show me the details on the MCX login items which are my network mounts. The script considers them “missing”. I can however, use AppleScript to show me local login items such as the iTunes helper, the Entourage Database daemon, etc. For some reason, AppleScript cant get MCX info.
Here is the AppleScript source code:
tell application “System Events”
set itemsList to name of login items
end tell
set text item delimiters to return
display dialog “Current Login Items:” default answer (itemsList as text)When executed, the AppleScript above gives me this information:
missing value
missing value
missing value
missing value
missing value
missing value
missing value
missing value
AdobeResourceSynchronizer
Microsoft Database Daemon
iTunesHelperThe “missing values” are my SMB volumes which are mounted via an MCX policy at login time. I happen to have 8 SMB volumes that I mount at login – I assume they correspond with the 8 missing items.
Any ideas as to why AppleScript cant figure out what the “missing values” are?
March 17, 2008 at 5:50 pm #371909khiltd
ParticipantTry something like:
[code]
tell application “System Events”repeat with curItem in every login item
–do something here
end repeat
end tell
[/code]and look at the properties for each item. ScriptDebugger can be extremely helpful for this kind of exploratory surgery.
-
AuthorPosts
- You must be logged in to reply to this topic.
Comments are closed