Azure Files: PowerShell problem : Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed RRS feed

  • Question

  • Original question https://social.technet.microsoft.com/Forums/windowsserver/en-US/1df53306-5123-4281-9ca3-510de4835b02/powershell-attempting-to-perform-the-initializedefaultdrives-operation-on-the-filesystem?forum=win10itprogeneral

    I was fiddling with Azure Files service to check out its Internet-accessible SMB shared folder behaviour.

    Mapping a drive letter with NET USE was simple enough. (although disturbed they don't offer a read-only access key, and must use full admin write access key) The significant thing though, is we're mapping a drive letter for NT AUTHORITY\SYSTEM context, done so via a scheduled task to run on system start. That works ok too.

    However, now when I launch up PowerShell ISE, it's stuck forever at loading. Nothing can be done other than to kill powershell_ise.exe.

    When I run a regular PowerShell shell, I see an error Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed

    If I disconnect the drive letter than the problem goes away.

    Thing is, previously, we were mapping the drive letter to an IIS WebDAV web server and didn't face any such problem. What sort of differences with Azure's public SMB server(s) can cause this limbo?

    The melody of logic will always play out the truth. ~ Narumi Ayumu, Spiral

    Wednesday, March 18, 2020 9:05 AM

All replies

  • @icelava I need more information on this query!  Which version of PS are using? Can you try in different system/VM and let me know the status? Never came across this kind of error message! More interested to work  closer on this issue

      Based on the error message on I found this information, https://windowsserver.uservoice.com/forums/301869-powershell/suggestions/31937410-attempting-to-perform-the-initializedefaultdrives  

    The "net use" command only connects to the share in the context you are running. So you will have to run the "net use" in the same context your role will run.

    For web roles this will be "NT AUTHORITY\NETWORK SERVICE". To run "net use" in that context, you need a tool like psexec.exe, which you can download from Windows Sysinternals.

    Drives are mapped to your user token, and administrators have two tokens. Limited and elevated. Make sure you are using consistent tokens. I.e. if mapped while Run As Administrator then only programs running elevated can access that mapping.

    Wednesday, March 18, 2020 6:04 PM
  • @icelava Just checking in to see if the above answer helped. If this answers your query, do click “Mark as Answer” and Up-Vote for the same, which might be beneficial to other community members reading this thread. And, if you have any further query do let us know.
    Friday, March 20, 2020 6:44 PM
  • I'm operating PowerShell 5.1.18362.628 on my Lenovo laptop. NET USE is applied by SYSTEM because Lenovo Vantage utility run as a service as SYSTEM (for performing system hardware maintenance and update work); it cannot be customised to directly refer to an arbitrary HTTP web server for custom update repository, so the only way to fool it is to map a HTTP (WebDAV) URL to a drive letter, which worked fine.

    net use U: http://webdavserver/lenovoupdates /persistent:yes /y /user:.\username password

    The mapping happens via a scheduled task set to run as SYSTEM on system startup.

    Now when we try to make use of Azure Files service instead

    net use U: \\storageaccount.file.core.windows.net\lenovoupdates /persistent:yes /y /user:AZURE\storageaccount storagekey

    That works too - from Lenovo Vantage perspective - but when it comes to PowerShell itself, those problems occur.

    The melody of logic will always play out the truth. ~ Narumi Ayumu, Spiral

    Saturday, March 21, 2020 4:37 AM
  • Apologies for the delay response! This may require a deeper investigation, so If you have a support plan, I request you file a support ticket, else please do let us know, we will try and help you get a one-time free technical support. In this case, could you send an email toAzCommunity[at]Microsoft[dot]com referencing this thread. Please mention "ATTN subm" in the subject field and subscription ID. Thank you for your cooperation on this matter and look forward to your reply.

    Thursday, April 16, 2020 10:19 AM