MacOs için kendi hazırladığım veya düzenlendiğim scriptleri vakit buldukça bu sayfada paylaşıyor olacağım.

Yönetici hakkına sahip kullanıcıları kontrol etme (Admin Right Check)

#!/bin/bash

# Checks local admin accounts with UID above 501
# 501'in üzerinde UID'ye sahip yerel yönetici hesaplarını kontrol eder

list=()

# Generate user list with UID greater than 501
# 501'den büyük UID'ye sahip kullanıcı listesini oluştur

for username in $(dscl . list /Users UniqueID | awk '$2 > 501 { print $1 }'); do


# Checking which users are administrators or not with the command
# Komut ile hangi kullanıcıların yönetici olup olmadığı kontrol edilir


    if [[ $(dsmemberutil checkmembership -U "${username}" -G admin) != *not* ]]; then
	# Checked accounts are added to the string list
	# Kontrol edilen hesaplar dizi listesine eklenir
        list+=("${username}")
    fi
done

# Prints the list content
# Liste içeriğini yazdırır

echo "<result>${list[@]}</result>"

Manageengine Desktop Central Agent Uninstall

#!/bin/sh
# With this script, you can remove the Desktop Central Agent from the user's computers and make it drop from the console.
# Bu script ile kullanıcı bilgisayarlarından Desktop Central Agent'ını kaldırabilir ve konsoldan düşmesini sağlayabilirsiniz.

cd /Library/DesktopCentral_Agent/uninstall
sudo chmod 744 uninstall.sh
sudo ./uninstall.sh

Url adresinden zip olarak inen bir ugulamanın kurulması

#!/bin/bash
#  This script is valid for an application that downloaded from the url as a zip.
#  Bu komut dosyası, url'den zip olarak indirilen bir uygulama için geçerlidir.
####################################################
# Zip file is downloaded from url
# Unzip is done
# App is moved under applications
# The downloaded zip file is removed
####################################################
# Zip olarak dosya url den indirilir
# Unzip işlemi yapılır
# App uygulamalar altına taşınır
# İndirilen zip dosyası kaldırılır 
#  


cd /tmp

# Installing test
curl -L -o "test-mac.zip" "Url"
sleep 30s
unzip test-mac.zip
sleep 15s
mv -f test.app /Applications/
rm -Rf test-mac.zip

exit 0
#  A zero return value from the script upon exit indicates success
# İşlem tamamlandığında sonucu göster
#+ to the shell.

Url adresinden dmg olarak inen bir ugulamanın kurulması

#!/bin/bash
#  This script is valid for an application that downloaded from the url as a dmg.
#  Bu komut dosyası, url'den dmg olarak indirilen bir uygulama için geçerlidir.
####################################################
# Dmg file is downloaded from url
# attaching (mount) the downloaded test.dmg
# App is moved under applications
# The downloaded dmg file is removed
####################################################
# Dmg olarak dosya url den indirilir
# Dmg dosyası ekleme işlemi yapılır
# App uygulamalar altına taşınır
# İndirilen dmg dosyası kaldırılır 
#  


cd /tmp
curl -L -O https://test.dmg
sleep 30s
hdiutil attach test.dmg
sleep 10s
sudo cp -R /Volumes/test/test.app /Applications
hdiutil unmount /Volumes/test/
exit 0

exit 0
#  A zero return value from the script upon exit indicates success
# İşlem tamamlandığında sonucu göster
#+ to the shell.

Chrome kayıtlı passwordleri temizleme – Chrome password chache clean

#!/bin/bash

loggedInUser=$(stat -f%Su /dev/console)

ChromeSafeStorage=$(/usr/bin/security find-generic-password -a "Chrome" /Users/$loggedInUser/Library/Keychains/login.keychain | awk -F'"' '/svce/{print $4}')

if [ "$loggedInUser" != "root" ]; then
    if [ "$ChromeSafeStorage" == "Chrome Safe Storage" ]; then
        echo "Deleting Chrome Safe Storage for user $loggedInUser"
        /usr/bin/security delete-generic-password -s "$ChromeSafeStorage" /Users/$loggedInUser/Library/Keychains/login.keychain
        exit 0
    else
        echo "Could not locate the correct keychain entry to delete"
        exit 0
    fi
else
    echo "No-one logged in. Exiting"
    exit 0
fi

Klasör Yaratma -Create Folder

#!/bin/bash
#Creating folder under user profile
#Kullanıcı profilinin altında klasör yaratma

loggedInUser=$(/usr/bin/python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");')
realName=$(/usr/bin/dscl . read "/Users/$loggedInUser" RealName | tail -n 1 | /usr/bin/xargs)
folder="Folder Name"

mkdir -p "/Users/$loggedInUser/$Folder Name"

Dns önbelleğini temizleme – Cleaning dns cache

#!/bin/bash

#Flush Dns
sudo killall -HUP mDNSResponder

Docker Uninstall-1

#!/bin/bash

sudo /Applications/Docker.app/Contents/MacOS/Docker --uninstall

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

sudo rm -R "/Users/$loggedInUser/Library/Application Scripts/com.docker.helper"
sudo rm -R "/Users/$loggedInUser/Library/Containers/com.docker.docker"
sudo rm -R "/Users/$loggedInUser/Library/Containers/com.docker.helper"
sudo rm -f "/Users/$loggedInUser/Library/Preferences/com.docker.docker.plist"
sudo rm -R /Users/$loggedInUser/.docker

Docker Uninstall-2

#!/bin/bash

docker stop $(docker ps -q)
docker rm $(docker ps -qa)
docker rmi $(docker images -q)
docker network prune --force
docker container prune --force
docker volume prune --force
ps -ax | grep Docker
sudo rm -rf /Applications/Docker.app
sudo rm -f /usr/local/bin/docker
sudo rm -f /usr/local/bin/docker-compose
sudo rm -f /usr/local/bin/docker-credential-osxkeychain
sudo rm -f /usr/local/bin/docker-machine

loggedInUser=`/bin/ls -l /dev/console | /usr/bin/awk '{ print $3 }'`

sudo rm -R "/Users/$loggedInUser/Library/Application Scripts/com.docker.helper"
sudo rm -R "/Users/$loggedInUser/Library/Containers/com.docker.docker"
sudo rm -rf "/Users/$loggedInUser/Library/Preferences/com.docker.docker.plist"
sudo rm -R /Users/$loggedInUser/.docker

IPV6 Kapatma – IPV6 Turn OFF

#!/bin/sh
IFS=$'\n'
net=`networksetup -listallnetworkservices | grep -v asterisk`

for i in $net
do
    networksetup -setv6off "$i"
done
exit 0

Microsoft Office tam kaldırma – Microsoft Office full cleaning

#!/bin/bash

#It provides full cleaning by clearing app and cache.

#Uygulama ve önbelleği temizleyerek tam temizlik sağlar.
consoleuser=$(ls -l /dev/console | awk '{ print $3 }')

echo "logged in user is" $consoleuser

pkill -f Microsoft


folders=(
"/Applications/Microsoft Excel.app"
"/Applications/Microsoft OneNote.app"
"/Applications/Microsoft Outlook.app"
"/Applications/Microsoft PowerPoint.app"
"/Applications/Microsoft Word.app"
#
"/Users/$consoleuser/Library/Containers/com.microsoft.errorreporting"
"/Users/$consoleuser/Library/Containers/com.microsoft.Excel"
"/Users/$consoleuser/Library/Containers/com.microsoft.netlib.shipassertprocess"
"/Users/$consoleuser/Library/Containers/com.microsoft.Office365ServiceV2"
"/Users/$consoleuser/Library/Containers/com.microsoft.Outlook"
"/Users/$consoleuser/Library/Containers/com.microsoft.Powerpoint"
"/Users/$consoleuser/Library/Containers/com.microsoft.RMS-XPCService"
"/Users/$consoleuser/Library/Containers/com.microsoft.Word"
"/Users/$consoleuser/Library/Containers/com.microsoft.onenote.mac"
#
#
#### WARNING: Outlook data will be removed when you move the three folders listed below.
#### You should back up these folders before you delete them.
"/Users/$consoleuser/Library/Group Containers/UBF8T346G9.ms"
"/Users/$consoleuser/Library/Group Containers/UBF8T346G9.Office"
"/Users/$consoleuser/Library/Group Containers/UBF8T346G9.OfficeOsfWebHost"
)

search="*"


for i in "${folders[@]}"
do
    echo "removing folder ${i}"
    rm -rf "${i}"
done

if [ $? == 0 ]; then
     echo "Success"
else
     echo "Failure"
fi