Chapter 19. Inline .NET code

Richard Siddaway

PowerShell is .NET-based. This enables you to use the .NET framework in your PowerShell scripts by loading the relevant assemblies into PowerShell (if they aren’t part of the default assembly set) and then using them via New-Object. You can create intricate GUI applications as a front end to your scripts, for instance. Whether you should or not is a discussion for another time.

You can also use .NET code directly in your scripts, which is the topic of this chapter. You’ll see two ways of using .NET directly in your scripts. The first way involves creating a .NET class that you can then use for output or future processing. The second way enables you to create a class with methods you can use in ...

Get PowerShell Deep Dives now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.