Control a DLL using Powershell

Calum Halliday 1 Reputation point
2021-06-15T13:59:31.253+00:00

Hello I’m looking for some guidance on how I would be able to control a DLL file using a PowerShell script or what is the best way to achieve this. The DLL when run does nothing until it receives a particular value. I believe the only values it can receive are 0 or 1 and depending on the value it receives it will perform particular function in the application which runs in a web browser. I’m fairly new to learning and using PowerShell so any help would be great.

Thanks
Calum

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,587 questions
Windows Server PowerShell
Windows Server PowerShell
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.PowerShell: A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
5,510 questions
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Rich Matheisen 46,556 Reputation points
    2021-06-15T14:39:49.777+00:00

    A DLL does nothing by itself. It contains code that usually performs some common function, but without a process that uses that code it's more or less inert.

    So, for you to "control" it you have to supply the code that asks the DLL's code to run. That "control" is usually accomplished by loading the DLL and then calling a function that the DLL exposes. You can use the PowerShell "Add-Type" cmdlet to do this.

    Here's a longer explanation: use-powershell-to-interact-with-the-windows-api-part-1

    0 comments No comments

  2. Calum Halliday 1 Reputation point
    2021-06-15T15:42:32.38+00:00

    Thanks for that, after some investigation I've found that the only value that should be passed to the DLL should be 0, this would shutdown the application gracefully and allowed the server to be patched. Once the script it created it will ran as a scheduled task every month.


  3. Calum Halliday 1 Reputation point
    2021-06-16T06:19:57.79+00:00

    The software is for voice recording IP telephony calls, it is manually manged through a web interface where I can manually shut down or restart the software. I'll see if I can any where with the software vendor support team. Thanks for your input so far.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.