Add-Type -AssemblyName
doesn’t work in a class declaration: being that the file is loaded in one go and checked for errors before being executed, the assembly is not loaded. Solutions:- A script that loads assembly, then sources the class declarations.
- In a module, initialise RequiredAssemblies.
[System.Security.Principal.WindowsIdentity]::new($UserName)
creates a logon event (type 3) for the user.- Nullable types are unsurprinzingly not seen as vanilla types in constructor overloads.
- DNS TXT records do not follow CNames.