Freeze/Unfreeze users during Salesforce deployment

4 min readOct 19, 2021


In order to avoid annoying your production users during sensitive operations like deployment or data recovery batches, freezing users is a good practice to restrict access to your salesforce production org

Salesforce allow you to freeze the connexion without desactivate users thanks to the “freeze” feature.

Option 1: Manually

This method match when you have a few user to freeze/unfreeze, because it is time-consuming and annoying.

Navigate to the Salesforce Setup -> Users and click on a user you want to freeze. Then use the button on top of the page to Freeze or Unfreeze the users.

Option 2 : Data Loader

This solution could be very useful but you should have to modify manually a complex CSV file and can be a very hard debugging time in case of error.

Option 3: Apex

This solution is a good way to freeze/unfreeze users but it requires to have a strong knowledge of Apex code language.

If you want additional information regarding all these options, I strongly recommand you to read this article how to lock a salesforce org by freezing users

Option 4: one click with sfdx-hardis

This option is the easiest way to block acces to a salesforce organisation. With only a few click you will be able to freeze/unfreeze mass users.

sfdx-hardis setup

Please follow sfdx-hardis installation instructions , launch Visual Studio Code in an empty folder (or a sfdx project if you have one) and open sfdx-hardis extension (1)

Freeze users

In Production menu, click on freeze users (2), then click on Other when type of Salesforce org is prompted (3)

Authenticate to your production org on Salesforce login page

Go back to Vscode and select the profile you want to freeze. Be careful to not select your own profile, to be able to unfreeze users later.

A confirmation is needed to be sure you want to freeze all these users.

At this end of the process you can check the result on vscode terminal

If you see a warning message it is probably because you are not allow to freeze one or some profiles you selected before.

Unfreeze users

To unfreeze users the process is quite the same than to freeze user. The main difference is just that you have to click on “unfreeze users” on production menu.

Then, follow exactly the same steps than for freeze users.

You can see the result on the VsCode terminal

Recommendation before to freeze users

  • Always keep at least on system administrator user unfreeze
  • Test the freeze user feature on a sandbox before use it in production
  • Inform your org users that a maintenance operation will occur before freeze them.

If you are interested to use the command line for CI purpose or other you can check the documentation here :


sfdx hardis:org:user:freeze --excludeprofiles 'System Administrator'// ... your deployments commands ..sfdx hardis:org:user:unfreeze --excludeprofiles 'System Administrator'