Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
sh-3.2# ./setupMCX2.sh
+ ./setupMCX2.sh
+ local_desktop_GUID=B4247B97-F249-4409-8EA3-BA8E168BA0DA
+ local_laptop_GUID=15BEE70A-A32D-4A33-B740-93CBE95F75A4
+ changedMCX=true
+ /bin/mkdir -p -m 700 /private/var/db/dslocal/nodes/MCX
+ /bin/mkdir -p -m 700 /private/var/db/dslocal/nodes/MCX/users
+ /bin/mkdir -p -m 700 /private/var/db/dslocal/nodes/MCX/groups
+ /bin/mkdir -p -m 700 /private/var/db/dslocal/nodes/MCX/computers
+ /bin/mkdir -p -m 700 /private/var/db/dslocal/nodes/MCX/computergroups
+ /usr/sbin/chown -R root:wheel /private/var/db/dslocal/nodes/MCX
++ /usr/bin/uname -r
++ /usr/bin/cut -d. -f1
+ OSVERS=12
++ /usr/bin/dscl /Local/MCX list /
+ output='AFPUserAliases
Aliases
Automount
AutomountMap
ComputerGroups
ComputerLists
Computers
Config
Ethernets
Groups
Hosts
Mounts
NetGroups
Networks
People
PresetComputerGroups
PresetComputerLists
PresetComputers
PresetGroups
PresetUsers
Protocols
RPC
Services
SharePoints
Users'
+ '[' 12 -gt 10 ']'
+ /usr/bin/killall opendirectoryd
++ /usr/bin/dscl /Local/MCX list /
+ output='AFPUserAliases
Aliases
Automount
AutomountMap
ComputerGroups
ComputerLists
Computers
Config
Ethernets
Groups
Hosts
Mounts
NetGroups
Networks
People
PresetComputerGroups
PresetComputerLists
PresetComputers
PresetGroups
PresetUsers
Protocols
RPC
Services
SharePoints
Users'
+ '[' 0 -ne 0 ']'
++ /usr/bin/dscl /Search read / CSPSearchPath
++ /usr/bin/grep /Local/MCX
+ localMCXinSearchPath=' /Local/MCX'
++ /usr/bin/dscl /Search read / CSPSearchPath
++ /usr/bin/grep /BSD/local
+ currentSearchPathContainsBSDlocal=
+ '[' '' '!=' '' ']'
+ currentSearchPathBegin=/Local/Default
+ currentSearchPathEnd='/Active Directory/AD/domain.com'
+ /usr/bin/dscl /Search create / SearchPolicy CSPSearchPath
+ /usr/bin/dscl /Search create / CSPSearchPath /Local/Default /Local/MCX
+ /usr/bin/dscl /Search append / CSPSearchPath '/Active Directory/AD/domain.com'
+ changedMCX=true
+ '[' 12 -gt 11 ']'
+ MCXNODE=/Local/Default
++ /usr/bin/dscl /Local/MCX -read /Computers/local_desktop GeneratedUID
++ cut -f2 -d ' '
+ current_local_desktop_GUID=B4247B97-F249-4409-8EA3-BA8E168BA0DA
++ /usr/bin/dscl /Local/MCX -read /Computers/local_laptop GeneratedUID
++ cut -f2 -d ' '
+ current_local_laptop_GUID=15BEE70A-A32D-4A33-B740-93CBE95F75A4
+ echo 'Updating GUID for /Computers/local_desktop...'
Updating GUID for /Computers/local_desktop...
+ '[' 12 -gt 11 ']'
+ /bin/rm -f /private/var/db/dslocal/nodes/MCX/Computers/local_desktop.plist
+ echo 'was: B4247B97-F249-4409-8EA3-BA8E168BA0DA'
was: B4247B97-F249-4409-8EA3-BA8E168BA0DA
+ echo 'now: B4247B97-F249-4409-8EA3-BA8E168BA0DA'
now: B4247B97-F249-4409-8EA3-BA8E168BA0DA
+ /usr/bin/dscl /Local/Default -create /Computers/local_desktop GeneratedUID B4247B97-F249-4409-8EA3-BA8E168BA0DA
+ changedMCX=true
+ echo 'Updating GUID for /Computers/local_laptop...'
Updating GUID for /Computers/local_laptop...
+ '[' 12 -gt 11 ']'
+ /bin/rm -f /private/var/db/dslocal/nodes/MCX/Computers/local_laptop.plist
+ echo 'was: 15BEE70A-A32D-4A33-B740-93CBE95F75A4'
was: 15BEE70A-A32D-4A33-B740-93CBE95F75A4
+ echo 'now: 15BEE70A-A32D-4A33-B740-93CBE95F75A4'
now: 15BEE70A-A32D-4A33-B740-93CBE95F75A4
+ /usr/bin/dscl /Local/Default -create /Computers/local_laptop GeneratedUID 15BEE70A-A32D-4A33-B740-93CBE95F75A4
+ changedMCX=true
++ /sbin/ifconfig en0
++ /usr/bin/awk '/ether/ {print $2}'
+ macAddress=e8:06:88:cc:88:fc
+ '[' e8:06:88:cc:88:fc == '' ']'
+ '[' e8:06:88:cc:88:fc == '' ']'
++ /usr/sbin/system_profiler SPHardwareDataType
++ grep 'Model Identifier'
++ grep Book
+ IS_LAPTOP=
+ '[' '' '!=' '' ']'
+ computerRecordName=local_desktop
+ otherRecordName=local_laptop
++ /usr/bin/dscl /Local/MCX -read /Computers/local_desktop ENetAddress
++ cut -f2 -d ' '
<dscl_cmd> DS Error: -14136 (eDSRecordNotFound)
+ storedMacAddress=
+ echo 'Updating MAC address for /Computers/local_desktop...'
Updating MAC address for /Computers/local_desktop...
+ echo 'was: '
was:
+ echo 'now: e8:06:88:cc:88:fc'
now: e8:06:88:cc:88:fc
+ /usr/bin/dscl /Local/Default -create /Computers/local_desktop ENetAddress e8:06:88:cc:88:fc
+ /usr/bin/dscl /Local/Default -create /Computers/local_desktop comment Auto-Created
+ /usr/bin/dscl /Local/Default -delete /Computers/local_laptop ENetAddress
+ changedMCX=true
++ /usr/bin/dscl /Local/MCX -read /Computers/local_desktop hardwareuuid
++ cut -f2 -d ' '
<dscl_cmd> DS Error: -14136 (eDSRecordNotFound)
+ storedHardwareUUID=
++ /usr/sbin/system_profiler SPHardwareDataType
++ grep 'Hardware UUID:'
++ cut -d: -f2
++ cut -d ' ' -f2
+ thisHardwareUUID=11719499-5118-572F-B27B-81A87F407DC1
+ echo 'Updating Hardware UUID for /Computers/local_desktop...'
Updating Hardware UUID for /Computers/local_desktop...
+ echo 'was: '
was:
+ echo 'now: 11719499-5118-572F-B27B-81A87F407DC1'
now: 11719499-5118-572F-B27B-81A87F407DC1
+ '[' 11719499-5118-572F-B27B-81A87F407DC1 ']'
+ /usr/bin/dscl /Local/Default -create /Computers/local_desktop hardwareuuid 11719499-5118-572F-B27B-81A87F407DC1
+ /usr/bin/dscl /Local/Default -delete /Computers/local_laptop hardwareuuid
+ changedMCX=true
+ echo 'MCX settings were changed.'
MCX settings were changed.
+ '[' 12 -gt 11 ']'
+ /bin/mv /private/var/db/dslocal/nodes/Default/computers/local_desktop.plist /private/var/db/dslocal/nodes/MCX/computers/
+ /bin/mv /private/var/db/dslocal/nodes/Default/computers/local_laptop.plist /private/var/db/dslocal/nodes/MCX/computers/
+ '[' 12 -gt 10 ']'
+ /usr/bin/killall opendirectoryd
+ exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.