Privileges problem with Do schell script in Tell block

I am attemoting to write the following script to rename a user specified “Home” folder that doesn’t belong to them for a migration type project I’m doing here at work where we need to rename user’s home folders from a different admin account.

The problem is the “do shell script” part. When I run the script and the “If” condition is “true” I get the error ““Finder got an error: A privilege violation occurred.”” If I compile and run the script with out the “If” block, the “do shell script command” works perfectly.
I assume the problem has something with the shell script trying to be carried out as Finder (inside the If statement) rather than a different user or app or whatever in the absence of the “If” statement. Can someone explain this to me and/or how to fix it, please?

Here’s the script:

set the local_username to ""
repeat
	display dialog "Enter the local username:" default answer the local_username buttons {"Cancel", "Okay"} default button 2
	copy the result as list to {the local_username, the button_pressed}
	if the local_username is not "" then exit repeat
end repeat

set mypath to "/Users/"
set home_folder to (mypath & local_username)
set change_name to (home_folder & " " & (home_folder & "-test"))

tell application "Finder"
	if not (exists item (home_folder as POSIX file)) then
		
		beep 3
		tell me to display dialog "This folder doesn't exist. Please check the user name." buttons {"OK"} default button 2
	else
		do shell script ("mv " & change_name) with administrator privileges
		
	end if
end tell

Model: PowerMac G4 quicksilver
AppleScript: 1.10
Browser: Firefox 1.0
Operating System: Mac OS X (10.4)

I’m not sure of the ‘why’, but the how might be a simple ‘tell me to’…:

tell me to do shell script "blah blah blah"

This sets the focus back to your script and not the current target app (the Finder, in this case).

Browser: Safari 412
Operating System: Mac OS X (10.3.7)

Awesome. That worked fine. I’m still a little new to the Applescript thing and I wasn’t sure what the “tell me” thing was even though I’ve seen it before.
Thanks for clearing that up…it makes perfect sense.

Model: PowerMac G4 quicksilver
AppleScript: 1.10
Browser: Firefox 1.0
Operating System: Mac OS X (10.4)