First, you need to determine which app is generating the dialog. Then add a:
Tell application "Whatever"
Quit
End Tell
statment to your script. You can determine this by downloading a program called "MemMapper". It works like the Process Viewer in OS X, and list everything running on your system, names, memory used, etc. It's very handy.
Anyway, if you quit the app before you send the "restart" command, the dialog box is circumvented.
One word of caution, there is a reason why you get the dialog. You could possibly harm other computers, especially if they are using a shared file. You might also want to look into scripting the app that generates the dialog.
I'm thinking that the File Sharing extension handles this, you can open it in the Script Editor (via the Open Dictonary command) to get a list of commands you can use to automate it. Add these to your script and you're set.