Skip to main content
Question

Build a Computer Information script for your Help Desk

  • August 29, 2018
  • 80 replies
  • 422 views

Show first post

80 replies

Forum|alt.badge.img+4

@emily

Very nice info! Have you tried it? Trying to get the custom logo to work, but not sure how to make it work.


emily
Forum|alt.badge.img+26
  • Hall of Fame
  • May 5, 2021

@fredrik.virding I haven’t used it myself yet but I can try to tuck aside some time this week and see what I can come up with. The Mac Admins Slack may be another good resource for tip or some feedback on how to use it.


Forum|alt.badge.img+4

@emily

Noted! The rest of the features was pretty straight forward. Super slick.


Forum|alt.badge.img+1
  • New Contributor
  • April 25, 2024

Hello everyone,
I'm new to scripting and this helpdesk script is really great.
On the other hand, I would like the Mac address to be found in addition to the IP address when this command is used.

networkServices=$( /usr/sbin/networksetup -listallnetworkservices | /usr/bin/grep -v asterisk ) while IFS= read aService do activePort=$( /usr/sbin/networksetup -getinfo "$aService" | /usr/bin/grep "IP address" | /usr/bin/grep -v "IPv6" ) if [ "$activePort" != "" ] && [ "$activeServices" != "" ]; then activeServices="$activeServices\\n$aService $activePort" elif [ "$activePort" != "" ] && [ "$activeServices" = "" ]; then activeServices="$aService $activePort" fi done <<< "$networkServices" activeServices=$( echo "$activeServices" | /usr/bin/sed '/^$/d')

After several hours of searching, I can't find the solution so I'm asking you for help.


Forum|alt.badge.img+1
  • New Contributor
  • May 2, 2024

Hello everyone,
I'm new to scripting and this helpdesk script is really great.
On the other hand, I would like the Mac address to be found in addition to the IP address when this command is used.

networkServices=$( /usr/sbin/networksetup -listallnetworkservices | /usr/bin/grep -v asterisk ) while IFS= read aService do activePort=$( /usr/sbin/networksetup -getinfo "$aService" | /usr/bin/grep "IP address" | /usr/bin/grep -v "IPv6" ) if [ "$activePort" != "" ] && [ "$activeServices" != "" ]; then activeServices="$activeServices\\n$aService $activePort" elif [ "$activePort" != "" ] && [ "$activeServices" = "" ]; then activeServices="$aService $activePort" fi done <<< "$networkServices" activeServices=$( echo "$activeServices" | /usr/bin/sed '/^$/d')

After several hours of searching, I can't find the solution so I'm asking you for help.


I finally found a solution. Here is the modified script :)

networkServices=$( /usr/sbin/networksetup -listallnetworkservices | /usr/bin/grep -v asterisk ) while IFS= read -r aService do activePort=$( /usr/sbin/networksetup -getinfo "$aService" | /usr/bin/grep "IP address" | /usr/bin/grep -v "IPv6" ) if [ "$activePort" != "" ] && [ "$activeServices" != "" ]; then ipAddress=$(echo "$activePort" | /usr/bin/awk '{print $3}') macAddress=$( /sbin/ifconfig | /usr/bin/grep -B2 "$ipAddress" | /usr/bin/awk '/ether/ {print $2}') activeServices="$activeServices\\n$aService $activePort MAC: $macAddress" elif [ "$activePort" != "" ] && [ "$activeServices" = "" ]; then ipAddress=$(echo "$activePort" | /usr/bin/awk '{print $3}') macAddress=$( /sbin/ifconfig | /usr/bin/grep -B2 "$ipAddress" | /usr/bin/awk '/ether/ {print $2}') activeServices="$aService $activePort MAC: $macAddress" fi done <<< "$networkServices" activeServices=$( echo "$activeServices" | /usr/bin/sed '/^$/d')