Skip to main content

Download and install Lync for mac 14.0.8 using bash script.

#!/bin/bash
#Download and install Lync for mac 14.0.8 using bash

USERNAME=$(ls -l /dev/console | awk '{print $3}' )
#get current username of AD user
HOME=$(sudo dscl . -read /Users/$USERNAME NFSHomeDirectory | awk '{print $2}')
#get user's home directory
MobileUsers=`dscl . read /Users/$USERNAME OriginalNodeName | grep "Active Directory"`
#do only for AD users
dmg="lync_14.0.8_140321.dmg"
give the current folder name
logfile="/private/var/log/Lyncwebupgrade.log"
log () {
echo $1
echo $(date "+%Y-%m-%d %H:%M:%S: ") $1 >> $logFile
}
#logging function
receipt='/private/var/db/receipts/com.microsoft.lync.all.lync.pkg.14.0.8.plist'
if [ -f "$receipt" ]
then
log "lync reciept found aborting"
exit 0
else
check=$(osascript -e 'tell application "System Events" to display dialog "Your Lync is out of date, please click OK to upgrade Lync" with title "Lync Sign in Details" with icon note buttons {"OK","Do Later"} default button 1')

if [[ $check =~ OK ]];
then
#kill lync if open
LYNC_PID=$(ps ax | grep "/Applications/Microsoft Lync.app/Contents/MacOS/Microsoft Lync" | grep -v grep | awk '{ print $1 }')
kill -9 ${LYNC_PID}
if [ $? = 0 ] ; then
log "Lync is open killing it now "
else
log "Lync is not running"
fi
for username in $MobileUsers
do
#this is in case user had pervious version of Lync
rm -rf $HOME/Documents/Microsoft\ User\ Data/Microsoft\ Lync\ Data/sip_*
done
log "Removed SIP dir"
if [ -f "$dmg" ];   
then
#attach the dmg if its already on current folder
hdiutil attach "$dmg" -nobrowse -noverify -noautoopen
else
#dl the lync dmg
curl -O http://download.microsoft.com/download/5/0/0/500C7E1F-3235-47D4-BC11-95A71A1BA3ED/lync_14.0.8_140321.dmg
hdiutil attach "$dmg" -nobrowse -noverify -noautoopen
fi
/usr/sbin/installer -dumplog -verbose -pkg /Volumes/Microsoft\ Lync/Lync\ Installer.pkg -target / &>/private/var/log/Lyncwebupgrade.log
#install it silently
sleep 3
/usr/bin/hdiutil detach "/Volumes/Microsoft Lync"
sleep 3
rm -f lync_14.0.8_140321.dmg
#remove the dmg
#add lync icon to dock, again only for AD users
for username in $MobileUsers
do
defaults write $HOME/Library/Preferences/com.apple.dock.plist persistent-apps -array-add "tile-datafile-data_CFURLString/Applications/VMware Fusion.app/_CFURLStringType0"
log "Lync icon added to dock"
done
sleep 5

chown $USERNAME:"CORP\Domain Users" $HOME/Library/Preferences/com.apple.dock.plist
chmod 600 $HOME/Library/Preferences/com.apple.dock.plist
log "perms changed on dock plist"

killall -HUP cfprefsd
killall -HUP Dock
sleep 3
log "bounced dock"


else
log "user declined"
exit 0

fi
fi
exit 0

Comments

Popular posts from this blog

Removing corporate wireless restrictions completely : "The policies of your network prevent the creation of ad hoc (computer-to-computer) networks. For more information, contact your system administrator."

So i was recently tasked with removing wireless restrictions from a VP's windows 7 laptop that some infrastructure company had placed while contracted with our network, since he needed to enable setting up of adhoc connections on his laptop and he always got

"The policies of your network prevent the creation of ad hoc (computer-to-computer) networks. For more information, contact your system administrator."


A little bit of probing revealed that adhoc and peer to peer connections were blocked as evidenced by the the command 

netsh wlan show filter on an  elevated command prompt revealed that adhoc network type was blocked by group policy:

I removed the restrictions by:

1: open services.msc as administrator, scroll down to WLAN AutoConfig:

Migrating Outlook Profile to Office 365

We had a migration from Hosted Exchange to Office 365 and i was tasked with automating the local Outloook profile migration for Users:

I Created a GUI utility using powershell which would allow users to create an Office365 Profile and set it as default, I prepared PRF files for each version of office and an autodiscover.xml to be used for local autodiscover and uploaded them to a hosted site:

The PRF file to set settings for Office 365 are hard to find: i used the below entries:


;AutomaticallygeneratedPRFfilefromtheMicrosoftOfficeCustomizationandInstallationWizard;**************************************************************;Section1-ProfileDefaults;**************************************************************[General]Custom=1ProfileName=%UserName%-O365DefaultProfile=YesOverwriteProfile=YesModifyDefaultProfileIfPresent=false;**************************************************************;Section2-ServicesinProfile;**************************************************************[Service…

To Unlock Windows Update locked due to group policy.

To Unlock Windows Update locked due to group policy.




Open gpedit.msc and browse to the location /Computer Configuration/Administrative Templates/System/Internet Communication Management/Internet Communication Settings and double click "turn off access to all windows update features" and set it to disabled.