Can I use a 3rd party .NET API with Powershell?

Hi all,

Is it possible to use a 3rd party .net API designed for C# in Powershell?

The API is for teamwork.com and is installed via a Nuget package in Visual Studio.

Thanks for any help you can provide

Hi Swatto - Yes, you can use, and usually the .Net classes will be initialised or referenced

[pre]

Add-Type -AssemblyName Namespace.Class
or

or

$Object = New-Object Namespace.Class # Parameter if any
$Object.Property = {Get;Set;}
$Object.Method()

[/pre]

Thanks very much Kiran. I just need to figure out how to get the API without using the Visual Studio Nuget Package Manager.

Here’s an example. Make sure the dll isn’t blocked if it’s from another computer.

Add-Type -Path .\ServerCommandProxy.dll
Add-Type -Path .\CookComputing.XmlRpcV2.dll

$a = New-Object ServerCommandProxy($server,9191,$password)

You can download nuget.exe if you want to grab packages outside of e.g. VS.

https://docs.microsoft.com/en-us/nuget/install-nuget-client-tools