Category Archives: Powershell

Powershell: List .NET library/assembly references and dependencies

Hi,

.NET assemblies often have some dependencies. You can use .NET reflection tolist the dependencies:

$ASM=[Reflection.Assembly]::LoadFile("C:\temp\webdriver\lib\netstandard2.0\WebDriver.dll")
$ASM.GetReferencedAssemblies()

Version        Name
-------        ----
2.0.0.0        netstandard
8.0.0.0        System.Text.Json
8.0.0.0        Microsoft.Bcl.AsyncInterfaces
4.2.0.1        System.Threading.Tasks.Extensions
8.0.0.0        System.Text.Encodings.Web

When loading and you got an “Retrieve the LoaderExceptions property for more information.” add the Add-Type call into a try/catch block to get a verbose answer:

Eable logging

reg add HKLM\Software\Microsoft\Fusion /v EnableLog /d 1 /t REG_DWORD
try {
 Add-Type -Path D:\Temp\TestWebDriverNetCore\bin\Debug\net8.0\WebDriver.dll 
} 
catch 
{
 write-host ( $_.Exception.LoaderExceptions) 
}

Michael

Powershell 7: Use Powershell 7 as WinRM shell

Hi,

to enter a Powershell 7 shell over WinRM setup the machines as followed:
Continue reading Powershell 7: Use Powershell 7 as WinRM shell

Windows: Check if Powershell process is the 32 or 64 Bit Version

Hi,

sometimes it is importend, when writing to the registry or file system in regions where the architecture redirection active, to known on which version a script runs.

Continue reading Windows: Check if Powershell process is the 32 or 64 Bit Version

Powershell: Create a powershell module

Hi,

this describes the creation of an powershell module.

Continue reading Powershell: Create a powershell module

Windows: Reset, enable and configure Powershell remoting

Hi,

here are the steps to reset WinRM service and start from scratch.
Continue reading Windows: Reset, enable and configure Powershell remoting