Self Service - Home Share - Folder Creation

New Contributor

I have been using the following code to create a folder on a users AD assigned home share then populating an alias on the desktop for the new folder:
--Set some values for reuse
set theUser to do shell script "whoami" --return lower case values
set theUserPath to do shell script "whoami | tr '[a-z]' '[A-Z]'"
set theFilePath to "/Volumes/" & theUserPath & "$/User_Profile/SharedBox" as Unicode text
set serverAddress to do shell script "dscl . -read /Users/" & theUser & " SMBHome | awk '{print $2}' | tr '' '/'"

--display dialog theFilePath

tell application "Finder"

mount volume "smb:" & serverAddress

delay 2

do shell script "mkdir -p " & theFilePath

delay 2

set theFile to POSIX file theFilePath as text set theAlias to make new alias file at POSIX file ("/Users/" & theUser & "/Desktop") to theFile set the name of theAlias to “SharedBox (Online)"

end tell

I am currently using AppleScript to perform these functions, but I'm wondering if there is a more efficient way to achieve the same goal. Appreciate any guidance.


Release Candidate Programs Tester

We do something similar.

But we have show mounted servers enabled in the Finder via MCX & just mount the share to the desktop.

The path is from the users SMBHome attribute too.

When creating the home folder in AD, it should create it at the path you specify. If that not happening?