├── .gitignore ├── LyncSetup-1.2.sh ├── MicrosoftLyncRegistrationDB.plist ├── README └── net.talkingmoose.LyncSetup.plist /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /LyncSetup-1.2.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ########################### About this script ########################## 4 | # # 5 | # Purpose: Populates user name and email address settings # 6 | # for Lync for Mac. This script resides # 7 | # in /Library/talkingmoose/Scripts and is launched # 8 | # by launch agent net.talkingmoose.LyncSetup.plist. # 9 | # # 10 | # Created by William Smith # 11 | # Last update May 4, 2012 # 12 | # # 13 | # Version history # 14 | # 1.2 Added keys to not ask Lync to be the conference provider, # 15 | # presence and telephone provider # 16 | # 1.1 Added NetBIOS domain variable for Lion support # 17 | # Removed support for local dscl lookups # 18 | # 1.0 Created LyncSetup-1.0.sh script # 19 | # # 20 | # Instructions # 21 | # Locate the NETBIOSDOMAIN line below and enter your company's NetBIOS domain # 22 | # name. Save the script as "LyncSetup-1.2.sh" into each computer's # 23 | # /Library/talkingmoose/Scripts folder or any location of your choosing. # 24 | # Modify the net.talkingmoose.LyncSetup.plist launchd item to point to this # 25 | # script and place it into /Library/LaunchAgents. # 26 | # # 27 | # The launchd agent will launch the script at every user login. If it finds # 28 | # ~/Library/Preferences/com.microsoft.Lync.plist then the script will exit. # 29 | # Otherwise, it will do the following: # 30 | # 1. Determine the current Mac OS version # 31 | # 2. Get user's current login name # 32 | # 3. Read Active Directory for the user's email address # 33 | # 4. Populate the user's ~/Library/Preferences/com.microsoft.Lync.plist # 34 | # file with the Lync logon information. # 35 | # 5. Set the preference to not show the license agreement. # 36 | # 6. Write details of the setup to ~/Library/Logs/LyncSetup.log. # 37 | # # 38 | # # 39 | ################################################################################## 40 | 41 | 42 | 43 | # Running checkSetupDone function to determine if the rest of this script needs to run. 44 | # Yes, if $HOME/Library/Preferences/com.microsoft.Lync.plist file does not exist. 45 | # Otherwise, assume this setup script has already run for this user and does not 46 | # need to run again. 47 | 48 | 49 | checkSetupDone() { 50 | 51 | if [ -f $HOME/Library/Preferences/com.microsoft.Lync.plist ] ; then 52 | exit 0 53 | fi 54 | 55 | } 56 | 57 | 58 | 59 | populateUserInformation() { 60 | 61 | # Logfile 62 | 63 | LOGFILE="$HOME/Library/Logs/LyncSetup.log" 64 | 65 | # Script version 66 | 67 | SCRIPTVERSION=$0 68 | date "+%A %m/%d/%Y %H:%M:%S Running Script: $SCRIPTVERSION" >> $LOGFILE 69 | 70 | 71 | 72 | 73 | # Enter your company NetBIOS domain name here. Necessary for Mac OS X 10.7 and later. 74 | 75 | NETBIOSDOMAIN="TALKINGMOOSE" 76 | 77 | 78 | 79 | 80 | # Get Mac OS version 81 | 82 | MACOSVERSION=$( ( sw_vers -buildVersion ) | awk '{ print substr( $0, 0, 2 ) }' ) 83 | 84 | if [ $MACOSVERSION -gt 10 ] ; then 85 | date "+%A %m/%d/%Y %H:%M:%S Mac OS X version is Lion or higher." >> $LOGFILE 86 | else 87 | date "+%A %m/%d/%Y %H:%M:%S Mac OS X version is either Leopard or Snow Leopard." >> $LOGFILE 88 | fi 89 | 90 | 91 | 92 | 93 | # Get current username 94 | 95 | USERNAME=$( id -un ) 96 | 97 | if [ $? = 0 ] ; then 98 | date "+%A %m/%d/%Y %H:%M:%S User name is $USERNAME." >> $LOGFILE 99 | else 100 | date "+%A %m/%d/%Y %H:%M:%S ERROR! Unable to read user name." >> $LOGFILE 101 | fi 102 | 103 | 104 | 105 | 106 | # Look up user email address 107 | 108 | if [ $MACOSVERSION -gt 10 ] ; then 109 | EMAILADDRESS=$( dscl "/Active Directory/$NETBIOSDOMAIN/All Domains/" -read /Users/$USERNAME EMailAddress | awk 'BEGIN {FS=" "} {print $2}' ) 110 | else 111 | EMAILADDRESS=$( dscl "/Active Directory/All Domains/" -read /Users/$USERNAME EMailAddress | awk 'BEGIN {FS=" "} {print $2}' ) 112 | fi 113 | 114 | if [ $? = 0 ] ; then 115 | date "+%A %m/%d/%Y %H:%M:%S User email address is $EMAILADDRESS." >> $LOGFILE 116 | else 117 | date "+%A %m/%d/%Y %H:%M:%S ERROR! Unable to read user email address." >> $LOGFILE 118 | fi 119 | 120 | 121 | 122 | 123 | # Write user information to Lync preferences file 124 | 125 | defaults write $HOME/Library/Preferences/com.microsoft.Lync UserIDMRU '( { LogonName = '$USERNAME'; UserID = '\"$EMAILADDRESS\"'; } )' 126 | 127 | if [ $? = 0 ] ; then 128 | date "+%A %m/%d/%Y %H:%M:%S User logon name set to $USERNAME and user ID set to $EMAILADDRESS." >> $LOGFILE 129 | else 130 | date "+%A %m/%d/%Y %H:%M:%S ERROR! Unable to set user logon name to $USERNAME and user ID to $EMAILADDRESS." >> $LOGFILE 131 | fi 132 | 133 | 134 | 135 | 136 | # Accept license agreement - Prevents initial license agreement from appearing for each user 137 | 138 | defaults write $HOME/Library/Preferences/com.microsoft.Lync acceptedSLT140 -bool true 139 | 140 | if [ $? = 0 ] ; then 141 | date "+%A %m/%d/%Y %H:%M:%S License agreement accepted." >> $LOGFILE 142 | else 143 | date "+%A %m/%d/%Y %H:%M:%S ERROR! Unable to accept license agreement." >> $LOGFILE 144 | fi 145 | 146 | 147 | 148 | 149 | # Do not show conference provider alert 150 | 151 | defaults write $HOME/Library/Preferences/com.microsoft.Lync DoNotShowConfProviderAlert -bool true 152 | 153 | if [ $? = 0 ] ; then 154 | date "+%A %m/%d/%Y %H:%M:%S Set do not show conference provider alert." >> $LOGFILE 155 | else 156 | date "+%A %m/%d/%Y %H:%M:%S ERROR! Unable to set do not show conference provider alert." >> $LOGFILE 157 | fi 158 | 159 | 160 | 161 | 162 | # Do not show presence provider alert 163 | 164 | defaults write $HOME/Library/Preferences/com.microsoft.Lync DoNotShowPresenceProviderAlert -bool true 165 | 166 | if [ $? = 0 ] ; then 167 | date "+%A %m/%d/%Y %H:%M:%S Set do not show presence alert." >> $LOGFILE 168 | else 169 | date "+%A %m/%d/%Y %H:%M:%S ERROR! Unable to set do not show presence alert." >> $LOGFILE 170 | fi 171 | 172 | 173 | 174 | 175 | # Do not show telephone provider alert 176 | 177 | defaults write $HOME/Library/Preferences/com.microsoft.Lync DoNotShowTelProviderAlert -bool true 178 | 179 | if [ $? = 0 ] ; then 180 | date "+%A %m/%d/%Y %H:%M:%S Set do not show telephone provider alert." >> $LOGFILE 181 | else 182 | date "+%A %m/%d/%Y %H:%M:%S ERROR! Unable to set do not show telephone provider alert." >> $LOGFILE 183 | fi 184 | 185 | 186 | 187 | 188 | # Script spacer - adds a couple of blank lines to the end of the log session 189 | 190 | awk 'BEGIN { print "\n" }' >> $LOGFILE 191 | 192 | } 193 | 194 | checkSetupDone 195 | populateUserInformation 196 | 197 | exit 0 -------------------------------------------------------------------------------- /MicrosoftLyncRegistrationDB.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | Backward_Compatible_Version 9 | 1 10 | Current_Version 11 | 1 12 | hkey_local_machine\ 13 | <<MacRegNoValue>> 14 | hkey_local_machine\software\ 15 | <<MacRegNoValue>> 16 | hkey_local_machine\software\policies\ 17 | <<MacRegNoValue>> 18 | hkey_local_machine\software\policies\microsoft\ 19 | <<MacRegNoValue>> 20 | hkey_local_machine\software\policies\microsoft\communicator\ 21 | <<MacRegNoValue>> 22 | hkey_local_machine\software\policies\microsoft\communicator\configurationmode 23 | 1 24 | 25 | 26 | 27 | hkey_local_machine\software\policies\microsoft\communicator\serveraddressexternal 28 | im.talkingmoose.net 29 | hkey_local_machine\software\policies\microsoft\communicator\serveraddressinternal 30 | im.talkingmoose.pvt 31 | 32 | 33 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | LyncSetup 1.2 2 | © Copyright 2012 William Smith 3 | bill@officeformachelp.com 4 | 5 | 6 | Copyright and Creative Commons license 7 | 8 | Except where otherwise noted, this work is licensed under http://creativecommons.org/licenses/by/3.0/. 9 | 10 | This script may be freely modified for personal or commercial purposes but may not be republished for profit without prior consent. 11 | 12 | If you find this script useful or have ideas for improving it, please let me know. It is written for Lync for Mac 2011. 13 | 14 | 15 | The need for LyncSetup 1.2 16 | 17 | LyncSetup 1.2 enables an administrator to pre-populate a user's Lync login information so that the user doesn't need to do this. When used with the MicrosoftLyncRegistrationDB.plist file to pre-populate server addresses, it will eliminate the user from having to configure his Lync client and allow him to simply enter his password and log in to his account the first time he launches the application. 18 | 19 | The LyncSetup-1.2 script does the following: 20 | 21 | ▪ Populates the user name from his Mac OS X login information 22 | ▪ Populates the user email address from Active Directory 23 | ▪ Disables the first run license agreement 24 | ▪ Disables prompt for Conference 25 | ▪ Disables prompt for Presence 26 | ▪ Disables prompt for Telephone 27 | 28 | 29 | How to install LyncSetup 1.2 30 | 31 | 1. Copy the LyncSetup-1.2.sh file to a commonly accessible location on each user's workstation such as /Library/talkingmoose/Scripts. 32 | 2. Copy the net.talkingmoose.LyncSetup.plist file to /Library/LaunchAgents. 33 | 3. Copy the MicrosoftLyncRegistrationDB.plist file to /Library/Preferences. 34 | 35 | 36 | How to use LyncSetup 1.2 37 | 38 | Before installing the script open the LyncSetup-1.2.sh script using TextEdit or Bare Bones Software's BBEdit or free TextWrangler application. Change the "TALKINGMOOSE" NetBIOS domain name to your own company's NetBIOS domain name and save the file. 39 | 40 | The script file must be executable on each machine: 41 | 42 | sudo chmod +x /Library/talkingmoose/Scripts/LyncSetup-1.2.sh 43 | 44 | Use the same text editor to edit the MicrosoftLyncRegistrationDB.plist file and enter the correct server addresses: 45 | 46 | im.talkingmoose.net 47 | im.talkingmoose.pvt 48 | 49 | Support 50 | 51 | E-mail me at bill@officeformachelp.com. I will make every effort to answer questions about the script and work to correct bugs you may find. 52 | 53 | 54 | Change log 55 | 56 | 1.2 Added key to not ask Lync to be the Conference provider 57 | Added key to not ask Lync to be the Presence provider 58 | Added key to not ask Lync to be the Telephone provider 59 | Added MicrosoftLyncRegistrationDB.plist file 60 | 1.1 Added NetBIOS domain variable for Lion support 61 | Removed support for local dscl lookups 62 | 1.0 Created LyncSetup-1.0.sh script -------------------------------------------------------------------------------- /net.talkingmoose.LyncSetup.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Label 6 | net.talkingmoose.LyncSetup 7 | ProgramArguments 8 | 9 | sh 10 | /Library/talkingmoose/Scripts/LyncSetup-1.2.sh 11 | 12 | RunAtLoad 13 | 14 | 15 | --------------------------------------------------------------------------------