Attempting to perform the InitializeDefaultDrives operation on the ‘FileSystem’ provider failed.
Yesterday one of our check_mk monitoring scripts based upon PowerShell failed, because the error Attempting to perform the InitializeDefaultDrives operation on the ‘FileSystem’ provider failed. showed up. The initial reason for this is unknown but has to do with the New-PSDrive and Remove-PSDrive PowerShell commands we use inside the check_mk scripts.
Symptoms for the problem are:
- The network drive is shown as disconnected in the Windows Explorer but you can still open the network drive
- The network drive can not be disconnected as you receive the error “Drive is not connected”
- Get-PSDrive returns the network share
- net use does not return the network share
To remove the network drive I tried to remove all registry keys which belonged to it, killing the check_mk agent, restarting the virtual machine and so on. In the end I fixed it by disabling the check_mk agent, restarting the VM and re-enabling the check_mk agent.