Posted on 06-03-2019 10:53 PM
I hope I can get a little script help. I don´t think it should be a big job and propably afterwards also something that other could use
The issue is that when office updates are pending they are stored in $TMPDIR/MSau*
(the updates are staying there until they are installed which require a restart of the app). So if someone has an update for outlook pending and don´t restart, I can send out a prompt requesting them to restart(the prompt I can do on my own)
So I want create a script that first set the $TMPDIR - as the $TMPDIR is different from each client
Afterwards in the script should check if there is a MSau_xxxx/microsoft_powerpoint* (take powerpoint as example)
I can than base a EA on each office product, and know when I have to send out a message to the user if they have this EA and that fx powerpoint must be restartet.
Hope it is understandable what my intentions are
Posted on 06-05-2019 11:20 AM
Anyone?
Posted on 06-05-2019 12:42 PM
@jameson Patience, my friend.
#!/bin/bash
apps=(
Microsoft_PowerPoint
Microsoft_Word
Microsoft_Excel
Microsoft_Outlook
)
# Get all the MSau temp dirs (there can be multiple)
while read -r line; do
tempDirs+=("$line")
done <<< "$(/usr/bin/find "${TMPDIR%/}" -name "MSau*" -type d -maxdepth 1 -mindepth 1)"
# Look in each temp directory for any of the update packages, if they exist add them to the updates array
for tempDir in "${tempDirs[@]}"; do
for app in "${apps[@]}"; do
appFound=$(/usr/bin/find "$tempDir" -name "$app*" -type f -maxdepth 1 -mindepth 1 | awk -F '/' '{print $NF}')
if [[ -n "$appFound" ]]; then
updates+=("$appFound")
fi
done
done
# If the array is not empty, print out the array, otherwise print out an empty result
if [[ "${#updates[@]}" -ge 1 ]]; then
echo "<result>$( /usr/bin/printf '%s
' "${updates[@]}" )</result>"
else
echo "<result></result>"
fi
Posted on 06-05-2019 11:25 PM
Thank you very much :)
Running the script manually it works fine and rapport correct back, but when added it as EA it seems not to find anything on the client and rapport it is empty (yes have tried a recon first:) )
Posted on 06-06-2019 06:39 AM
@jameson Jamf Pro might not like the new lines in the output. I also found that sometimes the update packages look like "Word_16.23.19030902_to_16.25.19051201_Delta.pkg", so I accounted for that. Try this:
#!/bin/bash
apps=(
PowerPoint
Word
Excel
Outlook
SkypeForBusiness
)
declare -a updates
# Get all the MSau temp dirs (there can be multiple)
while read -r line; do
tempDirs+=("$line")
done <<< "$(/usr/bin/find "${TMPDIR%/}" -name "MSau*" -type d -maxdepth 1 -mindepth 1)"
# Look in each temp directory for any of the update packages, if they exist add them to the updates array
for tempDir in "${tempDirs[@]}"; do
for app in "${apps[@]}"; do
appFound=$(/usr/bin/find "$tempDir" -name "*$app*" -type f -maxdepth 1 -mindepth 1 | awk -F '/' '{print $NF}')
if [[ -n "$appFound" ]]; then
updates+=("$appFound")
fi
done
done
# If the array is not empty, print out the array, otherwise print out an empty result
if [[ "${#updates[@]}" -ge 1 ]]; then
echo "<result>${updates[*]}</result>"
else
echo "<result></result>"
fi
Posted on 06-06-2019 10:16 PM
No - still not working. If no updates are there it rapports none - so somehow it must be the naming etc since nothing is showed when updates are there
Posted on 06-10-2019 10:24 PM
I cannot help on the scripting, but could be interesting to get this EA working so it Is possible to track which clients that have updates pending.
Maybe @mm2270 ] can help on this as I know he is a scripting "guru" :)
Posted on 06-11-2019 06:34 AM
It must have something to do with the multi-line result and Jamf Pro not liking that. I don't want to test the EA in my environment though.
Posted on 06-12-2019 06:02 AM
By default, Microsoft AutoUpdate (MAU) checks for updates every 12 hours. If updates are pending, users get notified. You could use a configuration profile to increase the check frequency and MAU will notify users more often without you having to do anything.
Posted on 06-12-2019 10:54 AM
This little slide in no users take note of - Guess it is part of to many things during the years has been sliding in and often with unecessary information.
So hope it Can be solved
Posted on 06-13-2019 03:34 AM
Yes Usera are not good to note these information sliding in. I am not a script guy, but is there any other way to create the script as there often a various ways to reach the goal