Connected Shares

jeremy_spolande
New Contributor

Hi,

Does anyone know of the best way to collect which network shares users are connected to in inventory. Would help us to know who actually connects to some of our shares and which protocol they are using.

Im guessing an extension attribute is the way to go but not sure what.

Thanks

8 REPLIES 8

jeremy_spolande
New Contributor

AM playing with df -h but need to get the actual path, it knows it as it is shown when you do a "get info" window on the mounted share.

thoule
Valued Contributor II

The mount command in terminal can show mounted volumes and connection type (smb or afp). You'd have to do a little grep/awk to put it in the format you want though..

jeremy_spolande
New Contributor

Thanks, will look at that, on 10.9 only (which is fine for this task) the new command "smbutil stashares -a" does the job in terminal but im struggling to get that into an extension atrtrbute.

nessts
Valued Contributor II

+1 mount (maverick) HPESetc 49 7:25am% mount |awk '/smbfs/{print $1}'
//nessts@hpdev.local/WIP

not sure what you want in the output if you want just the server name or who is mounting etc.

jeremy_spolande
New Contributor

Thanks, we'd want server name and share definately, but ideally also username and smb_version so Im thinking smbutil does that nicely but either way is good if it works, running "mount |awk '/smbfs/{print $1}'" in terminal lists full path but not much else and agan cant quite get it into an EA.

jeremy_spolande
New Contributor



#!/bin/sh
mount |awk '/smbfs/{print $1}'

echo "<result>print $1</result>"
fi



only outputs the word print.

nessts
Valued Contributor II

i would think your EA should look more like

#!/bin/sh
echo"<result>mount |awk '/smbfs/{print $1}'</result>"

jeremy_spolande
New Contributor

cheers, still no joy.