CreateMobileAccount using Self Service

New Contributor III

hey all,

i'm trying to utilize: /System/Library/CoreServices/ -n

to prompt the user for the said parameter "-n" by using Self Service.

Currently what i have is:


un=`/usr/bin/osascript <<EOT
tell application "System Events"
    with timeout of 600 seconds
        set un to text returned of (display dialog "Please type in your mobile username" default answer "" with icon 2)
    end timeout
end tell

/System/Library/CoreServices/ -n "$un"

i've also tried to use a simple bash script to prompt via Terminal

# Ask the user for login details
username=$(read -r -p "Enter your Mobile Account Username: ")

/System/Library/CoreServices/ -n "$username"

but get the error: Enter your Username: test *user name "" was not found: 0 ((null))


Contributor III

Hi @raphhyyy

In your first script, the User's returned value is placed in the variable "$un". Not sure if it was an intentional omission, but you can set that variable "$un" to the end of the statement:

/System/Library/CoreServices/ -n "$un"