After Preparing to write... (opening drive) i have access denied. Everything stops with removed partitions, but new aren't generated. Error i can see is Error writing to storage



Then i saw error

Windows security error

  • 1
    not a Raspberry Pi related problem
    – jsotola
    Jan 31, 2022 at 16:06
  • Use 'run as administrator'
    – fcm
    Mar 2, 2022 at 17:47

3 Answers 3


If controlled folder access is turned on, you will not be able to even format the SD card as Fat32. The solution is to allow apps exceptions thru controlled folder access. Esp on win 11. so: Press Start, Type "Controlled folder access", and open that. you can now allow [specific] apps through Controlled Folder Access. It is a security feature to prevent virus-like activity.

When doing those steps myself, the 2 most recent blocked commands shown in there were the pi-imager and the format32 commands! once, they were both allowed though, then the 2 operations completed successfully.


In my case, I saw the error dialog from rpi-imager.exe of the cryptic message "error writing to storage" however I had no other indication of what the problem was.

I was using an SD card previously used with a Raspberry Pi 3 B. I'm not sure what was on it (possibly the old Windows IoT for Raspberry Pi 3) but I wanted to use the card with a recently purchased Raspberry Pi 4 B.

I was using a Dell mini-tower that has an SD card slot running Windows 10 Pro. When I first put the SD card into the slot, multiple windows displayed and I could look at files on the SD card. It appeared to be a Windows file system.

When I used rpi-imager.exe to install Raspberry Pi OS 64 bit, the dialog of "error writing to storage" displayed. The card was no longer readable by Windows so it appeared to have been reformatted or initialized in some manner but the rpi-imager.exe application couldn't install the OS onto the card.

At first I wondered if the write lock was set on the SD card but it wasn't.

Finally, in desperation I used an existing application, SD Card Formatter, to format the card which resulted in an SD card formatted for Windows.

Then I tried rpi-imager.exe again and received this much more helpful error dialog.

rpi-imager.exe error dialog writing Raspberry Pi OS to SD card

I then used the Windows Settings app from Start to access Windows Update & Security:

Windows Security ->
Virus & threat protection ->
Virus & threat protection settings ->
Manage Settings ->
Controlled folder access ->
Manage Controlled folder access ->
Allow an app through Controlled folder access

The last couple of applications that had tried to access a disk and been denied were listed with rpi-imager.exe being the most recent. I selected it to add to the Allowed List.

After allowing rpi-imager.exe to modify the SD card, the application was able to successfully write the image to the card. I then inserted the SD card into my new Raspberry Pi 4 and it booted and initialized successfully.

I had to redo the image after making a mistake with the Raspberry Pi OS configuration tool and had no problem reinstalling the OS on the SD card using rpi-imager.exe.


I had the same error. Just run the Raspberry Pi Imager "As Administrator".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.