Accessing files stored on a USB-connected Windows 10 Phone from PowerShell RRS feed

  • Question

  • Hi,

    When I connect my Lumia 830 Windows 10 phone to my desktop PC, I can access the files from Windows Explorer, probably thanks to something that relies on the MTP protocol.

    I would like to script some operations on those files (e.g. if there are files in a certain folder on the phone, move them all to a folder on the PC).

    How can I access the phone's "filesystem namespace" from PowerShell?

    Tuesday, June 13, 2017 11:46 AM

All replies

  • Can you not access it via the drive letter it is mapped to?

    Step 1 Plug in phone and get drive letter (M - just used for discussion)

    Step 2 open PowerShell

    Step 3 type M: and hit enter

    You are now accessing the phones file system.

    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''

    • Edited by clayman2 Tuesday, June 13, 2017 12:35 PM typo
    Tuesday, June 13, 2017 12:12 PM
  • Windows 10 Mobile phones do not implement mass-storage over USB, only MTP. (When I had a Windows Mobile 6.5 HTC HD2, its µSD card would show up as a drive letter in Windows when connected to a PC.)

    As a result, one doesn't get a drive letter when connecting the phone, only a virtual folder of sorts in File Explorer:

    FWIW, please note the data I need to access resides on the phone's internal memory, not on the µSD card.

    Tuesday, June 13, 2017 1:09 PM
  • With the phone connected, open PowerShell and type Get-PSDrive, does anything show up that looks to be your phone?

    If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''

    Tuesday, June 13, 2017 1:13 PM
  • Nope.
    Tuesday, June 13, 2017 1:14 PM
  • Hi,

    Look at Windows.Storage.KnownFolders.RemovableDevices:



    Tuesday, June 13, 2017 4:27 PM
  • Install the phone software if not installed then configure to automatically copy to PC folders.


    Tuesday, June 13, 2017 6:18 PM
  • What software are you referring to?

    I don't want to "automatically copy" things, I want to write scripts that perform some manipulations with the phone's contents--one example (only) is to make sure certain folders on the phone are emptied by moving their contents to a folder on the PC.

    Tuesday, June 13, 2017 7:01 PM
  • I don't understand how this relates to my question.

    I want to write scripts on the PC side that manipulate the contents of folders on the phone and move data back and forth.

    Can't do that with a UWA running on the phone!

    Tuesday, June 13, 2017 7:02 PM
  • The Windows 10 Phone software on the PC will move files as prescribed.  You can also map a drive and it should be remembered each time you plug in the phone.

    By default the phone is not available directly and is only exposed as a storage device. 


    Tuesday, June 13, 2017 7:51 PM
  • Can you please be specific? What software are you referring to? Is this the desktop app whose name I keep forgetting?

    And remember: I want to automate (script) the process!

    Wednesday, June 14, 2017 7:50 AM
  • It is called "Windows Phone Companion" and can be installed if not present from the windows store:



    Wednesday, June 14, 2017 8:39 AM
  • That app, now dubbed "Microsoft Phone Companion", doesn't allow for automatic (unattended) move of the contents of some phone folder to some PC folder, nor does it allow assigning a drive letter to either the phone's internal storage or the phone's µSD:

    Wednesday, June 14, 2017 11:06 AM
  • Search for third party apps that can do what you ask.  By default the phone is not attached as a storage device.  You need special drivers for that.

    You can sync all folders and SD cards using OneDrive or GoogleDrive.  These will sync to you PC once set up.  You can mange these folders with a script.


    Wednesday, June 14, 2017 7:40 PM
  • I can't sync that data with any external storage provider because it's company confidential.

    That's the whole reason for scripting a mechanism that ensures that a particular folder on the phone is empty (and the data has been transferred to a company location) before I leave the company premises.

    Thursday, June 15, 2017 7:25 AM
  • Looks like you are out of luck.  You can download the Windows Phone SDK which has tools to read the system folders on a W10 phone.  Outside of that there is no way to do what you are asking.


    Thursday, June 15, 2017 8:16 AM