Start/Stop/Status of Filesharing (2025)

Is this the best way to start/stop/status filesharing for macOS ?

-- AppleScript to enable File Sharing on macOS

do shell script "sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.smbd.plist" with administrator privileges
do shell script "sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist" with administrator privileges

-- AppleScript to disable File Sharing on macOS

do shell script "sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.smbd.plist" with administrator privileges
do shell script "sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist" with administrator privileges

You should not use both ‘sudo’ and ‘with administrator privileges’ in one command.
Either one will do.