web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :
Business Central forum
Under review by Community Managers

Under review

Thank you for your post! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

How to use Windows Powershell in Business Central onprem?

Posted on by 5

Hello everyone!

I'm trying to execute a basic powershell script in BC:

dotnet
{
    assembly("System.Management.Automation")
    {
        type("System.Management.Automation.PowerShell"; "PowerShell") { }
    }
}

pageextension 50164 DotNetItem extends "Item List"
{
    trigger OnOpenPage()
    var
        Shelly: DotNet PowerShell;
    begin
        Shelly := Shelly.Create();
        Shelly.AddScript('C:\Users\MartinRuhland\Documents\Zeug\Testscript.ps1');
        Shelly.Invoke();
    end;
}

The code compiles, but throws a runtime error: "Ambiguous Match found"

The script itself works fine. Am i missing something? Is it even possible?

Regards

Martin

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Business Central

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans