title: Powershell Loading Binary Module
body: <p>I have few powershell script which I am trying to put into module. In the same module I also intend to load a c# dll for token generation. DLL uses System.Management.Automation.</p>
  
  <p><a href="https://i.stack.imgur.com/tW1Bd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/tW1Bd.png" alt="enter image description here"></a></p>
  
  <pre><code>#content of asr.psm1
  Import-Module ".\tokengenerator\PowershellTokenGenerator.dll"
  Get-ChildItem $psscriptroot\*.ps1 -Recurse | ForEach-Object { . $_.FullName }
  </code></pre>
  
  <p>The folder tokengenerator includes dll to generate OAuth2.0 token. How can I load powershell module and C# cmdlet under the same module. However, when I am trying to load the module I get the below error.</p>
  
  <pre><code>Import-Module D:\repo\src\aadsr\setup\asr.psm1
  
  Import-Module : The specified module '.\tokengenerator\PowershellTokenGenerator.dll' was not loaded because no valid module file was found in any module directory. At D:\repo\src\aadsr\setup\asr.psm1:1 char:1
  + Import-Module ".\tokengenerator\PowershellTokenGenerator.dll"
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : ResourceUnavailable: (.\tokengenerato...enGenerator.dll:String) [Import-Module], FileNotFoundException
      + FullyQualifiedErrorId : Modules_ModuleNotFound,Microsoft.PowerShell.Commands.ImportModuleCommand
  </code></pre>