I have a new shiny, high specification Windows 10 Laptop from my company. Naturally it is completely locked down from a security configuration.
I’m really fine with this. Developers should always work in least privilege and my company data should always be secured. Sure, it is easier to make progress with your Administrator override buttons, but the pain is just going to come back when you actually need to deploy something.
Microsoft gets this. Visual Studio code installs into my User Level profile without requiring any Admin privileges at all.
However, Salesforce doesn’t seem to get this. As far as I can tell there is no guidance around how to setup your development environment when using a locked down system.
However, you can install with least privilege, but takes a few manual steps which should take you no more than 10 minutes:
- Install Microsoft Visual Studio Code
- Install from https://code.visualstudio.com/
- Install Salesforce Extensions for VS Code
- Install from https://developer.salesforce.com/tools/vscode/
- Setup Java JDK
- Download a Java 11 JDK ZIP file (not executable). I used AdoptOpenJDK 11 – https://adoptopenjdk.net/releases.html
- Unzip to a folder you have access to, such as C:\Users\Andrew\Tools\JDK
- Setup NodeJS (with SFDX)
- Download NodeJS – https://nodejs.org/dist/v13.1.0/node-v13.1.0-win-x64.zip
- Unzip locally C:\Users\Andrew\tools\NodeJS
- Navigate to the folder in Command Prompt
- Execute following command: nodevars
- Execute following command: npm install sfdx-cli –global (and wait a while)
- Create a Windows Batch file on your desktop (or wherever):
- Create VSCodeLocal.bat with a text editor such as Notepad (be careful – notepad will probably put a hidden “.txt” as the suffix)
- Extend the PATH variable with the Java Bin and SFDX folders, and launch VSCode. See image below.
- Double click on VSCodeLocal.bat
- I recommend running this from the command line first to ensure that no errors are experienced
- Always run from this batch file. Directly running from the Visual Studio Code desktop/menu icon won’t work.
So at this point you should have a (mostly) working SFDX development environment on your locked down Windows 10. Do let me know in the comments if any steps require elaboration.
- Try installing normally first. Your PC may not be as restricted as mine.
- Most SFDX commands work, such as ‘SFDX: Create Project’, SFDX: Authorize an Org’, ‘SFDX: Create Lightening Web Component’ and ‘SFDX: Deploy This Source to Org’. I haven’t tested everything.
- Installing the SFDX local development server doesn’t work for me because my company policy doesn’t allow scripts to be run. Your mileage may vary.
- 100% credit to https://www.vermanshul.com/2019/11/quick-tips-setup-sfdx-manually-without.html for the NodeJS/SFDX setup
- This process will probably generally work for a restricted MacOS as well. Ensure that you set up launching from the command line in VS Code: Shell Command: Install ‘code’ https://code.visualstudio.com/docs/setup/mac
- Versions of all these tools will change all the time. The JDK 11 will probably be fine for years to come, but everything else should be latest as possible.
- As far as I can tell, this configuration is likely not supported by Salesforce.