Forcing logout of iCloud

New Contributor III

When I joined my current company a couple of years ago, we left iCloud usage on for computers. Eventually we reached a point where we disallowed and blocked the ability to use iCloud on newly issued work machines.

I have the right sign offs in place to now go after those with existing machines with iCloud turned on.

My question is, what is the best way to sign these users out? I've seen some other posts mention deleting a specific file or folder and this causes the users to have to log back in. However my testing is not 100% working all the time.

Is there a script someone can share that does this effectively or at least does someone know what I should be looking for on a machine to get these accounts signed out?