Silent, unattended install in Microsoft Dev Box

I’m about to give up. I need to add a configuration step (userTask) in a configuration script that creates a Windows Dev Box.

With VS Code, all I need is this:

  • name: winget
    description: Install Visual Studio Code
    parameters:
    package: Microsoft.VisualStudioCode

But evidently there is no winget (or chocolatey) package avaialble that I could find. I had to search for a way to find download url’s for the installer since the download page just has buttons to install interactively.

I finally get the installer .exe, and try running it with --silent, then --squirrel-install, and I still get asked to accept the licence agreement, pick an install location, start folder menu, and additional tasks.

We have desktop standards and control the creation of new Dev Box’s for developers with specific standards. They can add more, but we want to make sure the baseline is complete before they start on their own.

How the heck can I do this?

Thanks

I figured out the command line flags to do the silent installation without prompting:

/CURRENTUSER /VERYSILENT /SP- /NORESTART

But it still runs cursor when it’s done. The log shows this at the end:

– Run entry –
2025-07-14 09:05:47.735 Run as: Original user
2025-07-14 09:05:47.735 Type: Exec
2025-07-14 09:05:47.735 Filename: C:\Users\sspotts\AppData\Local\Programs\cursor\Cursor.exe
2025-07-14 09:05:50.676 Deinitializing Setup.
2025-07-14 09:05:50.693 Log closed.

Is there a way to get it NOT to run Cursor.exe when complete? We’ll want the user to run it interactively when the Dev Box configuration completes, not during the configuration script execution.

It appears that a compiled script is run after the bits are installed, and it’s not a task you can stop from happening (running cursor.exe after the installation). I had to run the installer then wait and stop the cursor process.

For anyone using Microsoft Dev Box, this is the userTask I ended up with. It’s a lot more complex than what I showed for the VS Code installation.

The script part to set up a desktop icon was needed because the installer also doesn’t respect /TASKS=‘desktopicon’.

userTasks:
- name: powershell
  description: Install Cursor Editor and create shortcut
  parameters:
    command: |
     $logPath = 'C:\Windows\Temp\cursor-install.log'
      $installer = $env:TEMP + '\CursorUserSetup-x64.exe'
      $downloadUrl = 'https://downloads.cursor.com/production/a8e95743c5268be73767c46944a71f4465d05c90/win32/x64/user-setup/CursorUserSetup-x64-1.2.4.exe'

      '[' + (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') + '] Starting Cursor installation...' | Out-File -FilePath $logPath -Append

      if (-not (Test-Path $installer)) {
        '[' + (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') + '] Downloading installer...' | Out-File -FilePath $logPath -Append
        #Invoke-WebRequest -Uri $downloadUrl -OutFile $installer -UseBasicParsing -Headers @{ 'User-Agent' = 'Mozilla/5.0' }
      }

      '[' + (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') + '] Running silent install...' | Out-File -FilePath $logPath -Append
      $proc = Start-Process -FilePath $installer -ArgumentList '/CURRENTUSER', '/VERYSILENT', '/SP-', '/NORESTART', '/LOG=c:\windows\temp\cursor-install-exe.log' -PassThru -NoNewWindow

      # Wait for the installer process itself to exit
      while (-not $proc.HasExited) {
        Start-Sleep -Milliseconds 500
      }
      
      if (Get-Process -Name 'Cursor' -ErrorAction SilentlyContinue) {
        '[' + (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') + '] Cursor.exe detected. Stopping it...' | Out-File -FilePath $logPath -Append
        Get-Process -Name 'Cursor' -ErrorAction SilentlyContinue | Stop-Process -Force
      }

      '[' + (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') + '] Creating desktop shortcut...' | Out-File -FilePath $logPath -Append
      $exePath = $env:LOCALAPPDATA + '\Programs\Cursor\Cursor.exe'
      if (Test-Path $exePath) {
        $desktop = [System.Environment]::GetFolderPath('Desktop')
        $shortcutPath = Join-Path $desktop 'Cursor.url'

        Set-Content -Path $shortcutPath -Encoding ASCII -Value '[InternetShortcut]'
        Add-Content -Path $shortcutPath -Encoding ASCII -Value ('URL=' + $exePath)
        Add-Content -Path $shortcutPath -Encoding ASCII -Value ('IconFile=' + $exePath)
        Add-Content -Path $shortcutPath -Encoding ASCII -Value 'IconIndex=0'
      } else {
        '[' + (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') + '] Cursor.exe not found at expected path.' | Out-File -FilePath $logPath -Append
      }

      '[' + (Get-Date -Format 'yyyy-MM-dd HH:mm:ss') + '] Installation script completed.' | Out-File -FilePath $logPath -Append