How to connect MongoDB with PowerShell?


I already tried with the following code:

but it shows some errors:

New-Object : Exception calling “.ctor” with “1” argument(s): “Could not load file or assembly ‘System.Runtime.InteropServices.RuntimeInformation,Version=,`Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified.”
At D:\Users\xxxxxx\Desktop\Mongodb With Powershell\task1.ps1:8 char:11

How do I overcome this error?


I know I am little late but I have been playing around with Mongodb and Powershell for the last couple days. The easiest solution that I have found is to install the MongoDB cmdlets from the Powershell gallary:

Step 1: Get and install.

Mdbc is distributed as the PowerShell Gallery module Mdbc. In
PowerShell 5.0 or with PowerShellGet you can install it by this

Step 2: In a PowerShell command prompt import the module:

Step 3: Take a look at help:

Then go through the following steps to see if the setup is working:


How to connect MongoDB with PowerShell? by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply