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:

  1. https://danielweberonline.wordpress.com/2012/01/30/query-and-update-data-on-mongodb-using-powershell/
  2. http://kowalski.ms/2012/07/04/working-with-mongodb-and-powershell/#comment-21942

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!
CV

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

http://fatbeards.blogspot.com/2012/02/powershell-and-mongodb.html

Here’s another mention:

http://powershellstation.com/2010/08/10/powershell-and-mongodb/

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:
https://gist.github.com/Gab-km/25b00d110e4fea0306a4

$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!!