According to https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-item?view=powershell-6 `Set-Item` is not supported by the FileSystem provider and so should not be used bei the GridFS-Provider. `Set-Content` should be used instead (see https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/set-content?view=powershell-6)