UI in Self Service Policies

New Contributor

Hi There,


If there is a similar thread already - sorry i could not find it.


My question is following - We want to make a couple of Policies in Self Service where there is some for of UI. Forexample a policy to create a new account, and to have a Dialog window asking for name and password, etc.. (Users dont have admin access). 


We are trying to make an easy enrollment for workers who use a certain mac for maybe a week, then pass it on to another colleague. Practically we are hopign that maybe via Self Service, when the new user gets their laptop (or the before the old user gives back the laptop) that they via self service they can delete their own user, or create it. 


Instead of having to reenroll the mac everytime it changes hands. 


Any thoughts to this? Thanks


Legendary Contributor III

You'll probably want to look at using osascript (AppleScript) within a script for something like this, which can display fields for secure text input. Here's a simple example showing this:


usernamePrompt=$(/usr/bin/osascript <<- EOD
tell application "System Events"
	get text returned of (display dialog "Enter your username below:" default answer "")
end tell

passwordPrompt=$(/usr/bin/osascript <<- EOD
tell application "System Events"
	get text returned of (display dialog "Enter your password below:" default answer "" with hidden answer)
end tell

echo "$usernamePrompt"
echo "$passwordPrompt"