Files
Alte_Skripte/de.ing. Activated_FileVault_enroll
2026-02-16 15:05:15 +01:00

50 lines
1.3 KiB
Bash

#!/bin/bash
##########################################################################
# Script : Activated FW-PW
# Autor : Andreas Vogel
# Copyright : macenterprise gmbh, 2020
##########################################################################
unset enable_fv
############################################# Variablen #########################################################################
Status=$(fdesetup status | head -1 | cut -d ' ' -f 3)
echo $Status
DecryptString() {
echo "${1}" | /usr/bin/openssl enc -aes256 -d -a -A -S "${2}" -k "${3}"
}
adminName="$7"
adminPass=$(DecryptString "$4" "$5" "$6")
############################################# Funktion #########################################################################
enable_fv () {
expect <<EOF
spawn fdesetup enable
expect "Enter the user name:"
send "$adminName\r"
expect "Enter the password for user $adminName:"
send "$adminPass\r"
expect EOF
EOF
}
############################################# Ausführung #############################################################################
if [[ $Status =~ "Off" ]]
then
echo "Exit Code: FileVault is disabled and will now be enabled."
if enable_fv
then
sleep 120
jamf recon
else
echo "Exit Code: FileVault 2 konnte nicht aktiviert werden."
fi
else
echo "FileVault is active."
jamf recon
fi