Script to Join and Disjoin a desktop

Please help me with a Script for Disjoining a Desktop from one domain and then join to different domain. I need this script to do activity on 700 PC’s

What do you have so far? It’s not like domain joining is a topic that hasn’t been widely discussed.
Also is powershell remoting available?

Removing and adding to domains is the easy part. What are you doing about resetting the user profiles and the permissions on the data on those machines?