Skip to main content
1 of 7
tukan
  • 2.3k
  • 13
  • 20

Issue with my roaming profile powershell producing - Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed

This is really annoying error - Attempting to perform the InitializeDefaultDrives operation on the 'FileSystem' provider failed., which I get every time I start powershell when outside company's network.

A short description:

I have a domain notebook. There are two ways I'm using it. First is inside company's network and everything works fine. Second way is when I'm outside the office, I connect via VPN, produces above mentioned error every time I start powershell.

Script to search for the drive:

From my re-search of the error the cause appears to be un-connectable drive or resource.

I have tried to find out what could be the cause. Since there were some changes to the home folder structure I suspected it.

I have executed on both locations this script:

Write-Verbose -Message 'Get-PSDrive -PSProvider FileSystem' -verbose
echo 'Get-PSDrive -PSProvider FileSystem' | Out-File -Append -Encoding "UTF8" -FilePath filesystem.log
Get-PSDrive -PSProvider FileSystem | Out-File -Append -Encoding "UTF8" -FilePath filesystem.log

Write-Verbose -Message 'net use' -verbose 
echo 'net use' | Out-File -Append -Encoding "UTF8" -FilePath filesystem.log
net use | Out-File -Append -Encoding "UTF8" -FilePath filesystem.log

Write-Verbose -Message '[System.IO.DriveInfo]::GetDrives() | Format-Table' -verbose
echo '[System.IO.DriveInfo]::GetDrives() | Format-Table' | Out-File -Append -Encoding "UTF8" -FilePath filesystem.log

[System.IO.DriveInfo]::GetDrives() | Format-Table | Out-File -Append -Encoding "UTF8" -FilePath filesystem.log

# does not work properly
# Write-Verbose -Message 'Get-CimInstance -ClassName Win32_LogicalDisk -ComputerName $env:COMPUTERNAME' -verbose | Out-File -Append -Encoding "UTF8" -FilePath filesystem.log
#Get-CimInstance -Class Win32_LogicalDisk | Out-File -Append -Encoding "UTF8" -FilePath filesystem.log

Write-Verbose -Message 'Get-CimInstance -Class Win32_NetworkConnection' -verbose 
echo 'Get-CimInstance -Class Win32_NetworkConnection' | Out-File -Append -Encoding "UTF8" -FilePath filesystem.log
Get-CimInstance -Class Win32_NetworkConnection | Out-File -Append -Encoding "UTF8" -FilePath filesystem.log

Results:

There appears to be U:\ lurking from shadows (does not appear when on premises). That is the network drive that was disconnected and should not be used anymore. (there is some legacy programs using it and it should be applied via GPO rules)

net use produces:

U:        \\RPRMSFS01\U_login_name$   NFS Network

[System.IO.DriveInfo]::GetDrives() | Format-Table produces:

Name            DriveType DriveFormat       IsReady AvailableFre TotalFreeSpa   TotalSize RootDirecto VolumeLabel
                                                          eSpace           ce             ry                     
----            --------- -----------       ------- ------------ ------------   --------- ----------- -----------
C:\                 Fixed NTFS                 True   1779298304   1779298304 ...43488000 C:\         OSDisk     
U:\               Network                     False                                       U:\  

Get-CimInstance -Class Win32_NetworkConnection

LocalName                    RemoteName                   ConnectionState             Status                     
---------                    ----------                   ---------------             ------                     
     
U:                           \\RPRMSFS01\U_login_name$      Disconnected                Unavailable                

On the other hand, when on company's network directly there is no U:\ what so ever.

What I have tried to rectify the situation

  • manual disconnect - error is produced This network connection does not exist

  • suggestions found on internet:

  1. Change GPO

    To resolve this issue, apply the following setting via group policy: User Configuration/Administrative Templates/System/Scripts/Run logon scripts synchronously = Enabled

  2. Mapped drive won't go away

I had really high hopes for this link Mapped drive won't go away - keeps reconnecting on logon I have same feeling as in the post - to quote:

I have indeed checked scripts and GPOs and this is nowhere to be found there. This looks more like a manual mapping that had the "Reconnect on logon" checkbox checked and is now so persistent that there was no "normal" way to undo it. 

Unfortunately, every suggestion there failed.

  • registry
  1. I have searched for the string in the registry and found it here: [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2]. I Tried to delete it, but it keeps coming back.

  2. I have also found it here (but did not experiment with it yet; I don't want to break the OS):

    Windows Registry Editor Version 5.00
    
    [HKEY_USERS\S-1-5-21-119559289-1840127793-336618761-855951\Volatile Environment]
    "HOMEDRIVE"="U:"
    "LOGONSERVER"="\\\\logon_server"
    "USERDNSDOMAIN"="dns_domain"
    "USERDOMAIN"="user_domain"
    "USERNAME"="login"
    "USERPROFILE"="C:\\Users\\login"
    "HOMEPATH"="\\"
    "HOMESHARE"="\\\\server_name\\U_login$"
    "APPDATA"="C:\\Users\\login\\AppData\\Roaming"
    "LOCALAPPDATA"="C:\\Users\\login\\AppData\\Local"
    "USERDOMAIN_ROAMINGPROFILE"="user_domain"
    
    [HKEY_USERS\S-1-5-21-119559289-1840127793-336618761-855951\Volatile Environment\1]
    "SESSIONNAME"="Console"
    "CLIENTNAME"=""
    

For now I have concluded that something is wrong with my roaming profile. I have to yet find the reason why the roaming profile is not update with correct information.

Does anyone have idea/experience how to fix such an issue?

tukan
  • 2.3k
  • 13
  • 20