Using MongoDB via PowerShell v4.0

Hello community,
I’ve recently tried to use a noSQL document database called MongoDB in order to store eventlog entry data.
I followed instructions from here:


I’m using WinServ2012 Powershell v4 but I deal with this console response:

Add-Type : Could not load file or assembly ‘file:///C:\mongodb\bin\MongoDB.Bson.dll’ or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515)
At line:1 char:1

  • Add-Type -Path “c:\mongodb\bin\MongoDB.Bson.dll”
  •   + CategoryInfo          : NotSpecified: (:) [Add-Type], FileLoadException
      + FullyQualifiedErrorId : System.IO.FileLoadException,Microsoft.PowerShell.Commands.AddTypeCommand

Is there any recommendation that would help me go further with this and store my data with this way?
Thank You very much!

According to this blog from 2012, you need a MongoDB C# driver to make this work:

Here’s another mention:

Thank you very very much for the reply MR Matt McNabb!!! This helped me much!!
While I was trying to deal with mongodb, I didn’t installed the exe file from mongoDB official site.
Contrary, I installed files manually and I created a service and a process for mongodb.
This was a fault I think because the installation didn’t fully complete.
I’ll try to install official .net driver from mongodb .exe tomorrow and I will reply here for what will happen.

In addition i found here:

$client = New-Object MongoDB.Driver.MongoClient(“mongodb://hostname”)

which shows that there’s a new way to “import” the dlls within powershell.

Whatever will happen I 'll reply here, if I will find a way to implement my database connection within Powershell!

thank you again I am looking forward for every one else knows something more!!