Configure Surface to use MicroSD as Primary Storage

After about a week of excitement and playing around with features, I decided it was time to start optimizing and making this thing run the way I wanted. The first thing I noticed was that I could not use my SD card with my Libraries, so all my apps are going to by default save to the local SSD, which is far from what I want. I knew there had to be a way around this, so I started digging in. I feel I finally have it to the point where others should be doing the same thing, and once done, you can forget about it.

  • Create a VHDX and save it on the SD card
  • Create directories on this VHD for your specific libraries
    • Documents
    • Music
    • Video
    • Pictures
  • Configure the libraries
  • Enable Indexing on the VHDX – This is important because the Photos app doesn’t work right without it.
  • Have a script automatically Attach the VHD on Boot

If you would like to know the exact steps to take, please continue reading.

Creating a VHD

  1. Open Charms Menu (Swipe in from the right side of the screen)
  2. Click Settings
  3. Click Tiles
  4. Change “Show administrative tools” to Yes
  5. Swipe from the bottom of the screen
  6. Click All apps
  7. Under “Administrative Tools” click Computer Management
  8. Click “Disk Management”
  9. Click “Action”
  10. Click “Create VHD”
  11. Browse to the SD Card’s storage and name the VHD whatever you want
  12. Allocate as much of the SD’s storage you want to this VHD,
  13. You can decide between Fixed or Dynamically expanding. I went with Dynamically expanding.
  14. Find the newly created disk in the lower panel, which should be “Disk 2”
  15. Right-click where it says “Disk 2”
  16. Click “Initialize Disk”
  17. Click OK
  18. Right-click “Unallocated”
  19. Click “New Simple Volume…”
  20. Click “Next >”
  21. Click “Next >”
  22. Select the Drive letter you want (can be anything)
  23. Click “Next >”
  24. Name the Volume whatever you want
  25. Click “Next >”
  26. Click “Finish”

Create/Configure Library Directories on VHD

  1. Click the “Libraries” icon from the “Task Bar”
  2. Single click “Documents”
  3. Click “Manage under “Library Tools” from the ribbon
  4. Click “Manage library”
  5. Click “Add”
  6. Browse to the newly Attached VHD you just created
  7. Click “New Folder”
  8. Name it whatever you want (Eg: Documents)
  9. DO NOT OPEN THE FOLDER, select the folder and click “Include folder”
  10. Remove the Default Personal folder
  11. Click OK
  12. Click “Set save location”
  13. Select the newly created folder
  14. Repeat steps 1-13 for the following
    1. Music
    2. Pictures
    3. Videos

Enable Indexing on VHD – Very Important

  1. Open the “Charms Menu”
  2. Click “Search”
  3. Type “Indexing Options”
  4. Click Settings
  5. Open “Indexing Options”
  6. Click “Modify”
  7. Select the newly Attached VHD
  8. Click OK
  9. Click Close

Create Script to Auto Attach on Startup

  1. Open PowerShell as an Administrator
  2. Type “Set-ExecutionPolicy RemoteSigned”
  3. Press Enter
  4. Type “y”
  5. Press Enter
  6. Click Computer from the navigation bar on the left of the Libraries folder
  7. Open the C: Drive
  8. Create a new folder named “PoSH”
  9. Double click the new folder
  10. Right-click in the white area and navigate to “New > Text Document”
  11. Name it Auto-Mount.ps1
  12. Open the new file with Notepad
  13. Paste the below code in, don’t forget to modify the red text to the path you saved the VHDX file at
    1. “Mount-DiskImage D:\YourVHD.vhdx”
  14. Open the “Charms Menu”
  15. Click “Search”
  16. Type “Task Scheduler” and open it
  17. Click “Task Scheduler Library”
  18. Click “Action”
  19. Click “Create Task…”
  20. General Tab
    1. Name: Attach SD VHD
    2. Location: \
    3. Description: This is the Task that automatically attaches the VHD file on the SD card on system boot.
    4. “Click Change User or Group…” type in SYSTEM
    5. Check “Run with highest privileges”
  21. Triggers Tab
    1. Click “New…”
    2. Begin the task: At startup
    3. Click OK
  22. Action Tab
    1. Action: Start a program
    2. Program/script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
    3. Add arguments: C:\PoSH\Auto-Mount.ps1
    4. Click “OK”
  23. Conditions Tab
    1. Under Power uncheck “Start the task only if the computer is on AC power
    2. Click “OK”
  24. Have fun testing. I recommend opening the Camera app and taking some pictures, making sure it index the new ones, try adding music to the folder make sure it shows up in the music app, the same thing for the Video app.

Update 12-30-2012: Thank you, Don, for reminding me you need to set the execution policy on the machine first.

Love it? Share it!

92 thoughts on “Configure Surface to use MicroSD as Primary Storage”

  1. Any info on what happens when you put the card into another device? (windows) I would like to keep to ability to use the card in other machines. Also can this not be set up like a usb hard drive maybe at the least to have an autorun.inf..

    I have found this
    http://www.lancelhoff.com/partition-a-usb-flash-drive-in-windows-xp/
    the main point being the ability to configure the card as a hdd.

    I don’t have the card or laptop I am planning this on but if I remember I’ll try and report here if I get it working.

    1. I like the idea of an autorun.inf, I am not sure what security practices have been put in place against that in Windows 8 but I will definitely experiment with this and let you know my findings. It’ll probably be next week before I get a chance to do that though. You should have no problem moving the MicroSD card between systems you will just need to mount the VHD on the new machine too.

  2. Hi Matt,
    You are a splendid fellow to help out strangers. Thanks on behalf of all of us.
    I did get it to work. Here’s how. I “bypassed” the auto-mount.ps1 file by typing “mount-diskimage d:\myvhd.vhd” in the “argument box” instead of C:\PoSH\Auto-Mount.ps1
    btw if anyone wants to replicate this, do not type the open quotes in front of the mount-diskimage d:\myvhd.vhd. (I put them there just to demarcate the text)

  3. I dug a little more deeply into task scheduler and looked in the “last run result”. it shows “incorrect function 0x8007001”

    1. I apologize in my delay to responding to you. I’ve been a bit backed up with the holidays, if you send me screenshots of the script, your Disk Management screen and your Scheduled Tasks I might be able to assist more.

    2. You need to show file extensions and rename your script file. Open a file folder, and go to the View tab. On the ribbon, click Options. Click the view tab. Turn off “Hide file extensions for known file types”

      Browse to you POSH folder, and you’ll probably find the file is named:

      “Auto-Mount.ps1.txt”

      rename to the ps1 file

      1. I get the same error. My script file extension is correct too. I’ve recreated the task and have triple checked it…still won’t mount. Thoughts?

        1. Pass the script to powershell.exe manually in the Run window, and see what the result is. It’ll only flash on the screen for a second, so be ready with the window-button/down volume combo to grab a screenshot of the error.

  4. Ive figured out a not-so-bad substitute for the non-nonfunctioning auto attach. I go to my d drive, right click on the .vhd file and that gives me an option to mount. Still, it would be nice to get the auto-attach to work.

  5. I cant get the autoattach to work either. I wasnt sure whether the code in the automount.ps1 should or should not have the inverted commmas. and whether it should be preceded by the 1. I tried all variations but no luck.
    I also changed the option in the General tab to configure for Windows 8 (for some reason the default was Vista) that didnt do any good either.
    it works fine i go into the disk manager and manually attach the vhd but thats a bit of a pain.
    Anyhow thanks for all the effort you have put into this. Nothing else was working for me!

  6. The Auto-Mount.ps1 file contains: Mount-DiskImage E:\SD_Card.vhd

    The configuration is as per the instructions above.

    How do you “implement” a scheduled task>

  7. Hi Matt,

    Thanks for the tutorial. I originally did it the way you did at first and then realized that anytime I added new photos it is impossible to get them to show up. So I have unconnected the drive paths I had set up and am trying to go through your steps to get things going. When I get to step 13 of Creating a VHD and click OK it gives me an error: “The requested operation could not be completed due to a file system limitation”. What can I do to get past this? Thanks again for your help! THis is super frustrating and I am baffled that Microsoft hasn’t fixed it yet.

    1. I got this error because the card was originally formatted exFAT, which seems to preclude its use as a VHD. At least, reformatting it as an NTFS volume before all this seemed to do the trick for me.

    1. David, that is a potential solution, in fact that is what I did initially following that exact article. However there is an error showing the thumbnails of the Camera Roll. If you use my method it showed the thumbnails.

  8. Great tutorial. You can actually just do
    powershell -command “mount-diskimage D:\image.vhd” instead of making a script file.

    1. That’s correct, that is actually the PowerShell cmdlet I use. However if someone is to power off their Surface it will not be re-mounted until you execute that command again. Personally I am lazy and I’d rather take extra steps setting it up then needing to remember to execute a command ever time I turn the tablet on.

Leave a Comment

Your email address will not be published. Required fields are marked *