Created
July 10, 2017 14:11
-
-
Save AndrewWCarson/67c8b6f36b232d97564c0b53a48ce76d to your computer and use it in GitHub Desktop.
Run a basic analysis of programs, users, and hardware on a Mac.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Establish host and username. | |
| HOST=`hostname` | |
| USER=`whoami` | |
| # Establish the correct path. | |
| LOG_DIR="/Volumes/Carson Utilities/Logs/" | |
| DIR="$LOG_DIR$HOST" | |
| # Loop variable. | |
| x="1" | |
| # Check to see if the path existed or not. | |
| while [ -d "$DIR" ] | |
| do | |
| DIR="$LOG_DIR$HOST$x" | |
| # THIS IS SUCH A WEIRD WAY TO DO MATH! | |
| x=$[$x+1] | |
| done | |
| echo $DIR | |
| # Create the machine's directory. | |
| mkdir "$DIR" | |
| # Change directory | |
| cd "$DIR" | |
| # Create a basic info file. | |
| echo "Data generated from Sys_Profiler script by Andrew Carson" > ./info.txt | |
| echo "User: $USER\nMachine: $HOST" >> ./info.txt | |
| # Generate a system information file. | |
| system_profiler -xml > ./sys_profile.spx | |
| # Copy the list of users from the machine. | |
| dscl . list /Users | grep -v '_.*' > ./users.txt | |
| # Generate a list of the machine's applications. | |
| ls /Applications > ./apps.txt | |
| # Copy the Microsoft Licensing File | |
| cp /Library/Preferences/com.microsoft.office.licensing.plist ./ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment