<p>There are many scenarios where it would be useful to call a Win32 function or some other DLL from a PowerShell script. to Given the following function signature:</p>

<pre><code>bool MyFunction( char* buffer, int* bufferSize )
</code></pre>

<p>I hear there is something that makes this easier in PowerShell CTP 2, but I'm curious how this is <strong>best done in PowerShell 1.0</strong>. The fact that the function needing to be called  <strong><em>is using pointers</em></strong> could affect the solution (yet I don't really know).</p>

<p>So the question is what's the best way to write a PowerShell script that can call an exported Win32 function like the one above?</p>

<p><strong>Remember for PowerShell 1.0.</strong></p>

There isn't any mechanism in PowerShell 1.0 to directly call Win32 API's. You could of course write a C# or VB.NET helper class to do this for you and call that from PowerShell.
Update: Take a look at -
http://blogs.msdn.com/powershell/archive/2006/04/25/583236.aspx
http://www.leeholmes.com/blog/ManagingINIFilesWithPowerShell.aspx