I want to use Powershell to write some utilities, leveraging our own .NET components to handle the actual work. This is in place of writing a small console app to tie the calls together. My question is where I would find a good source of documentation or tutorial material to help me fast track this?
-
Do you need info about simply using .Net assemblies in powershell, or are you looking for info on writing assemblies that are more powershell friendly? – EBGreen Aug 25 '08 at 14:37
3 Answers
If you want to load an assembly into your PowerShell session, you can use reflection and load the assembly.
[void][System.Reflection.Assembly]::LoadFrom(PathToYourAssembly)
After you load your assembly, you can call static methods and create new instances of a class.
A good tutorial can be found here.
Both books mentioned by EBGreen are excellent. The PowerShell Cookbook is very task oriented and PowerShell in Action is a great description of the language, its focus and useability. PowerShell in Action is one of my favorite books. :)

- 10,959
- 41
- 53
-
1@Sung Thanks, I'm actually working on a series about using .NET from PowerShell on my blog - http://blog.usepowershell.com/category/net-framework/introduction/ – Steven Murawski Mar 08 '09 at 17:38
-
:/ links are dead, can you update them? here's another one I found http://www.dougfinke.com/blog/index.php/2010/08/29/how-to-load-net-assemblies-in-a-powershell-session/ useful – Anthony Johnston Feb 26 '13 at 10:12
-
The link that Steven posted is a good example. I don't know of any extensive tutorial. Both the Windows Powershell Cookbook and Windows Powershell In Action have good chapters on the subject. Also, look at the ::LoadFromFile method of the System.Reflection.Assembly class in case your in-house assemblies are not loaded in the GAC.

- 36,735
- 12
- 65
- 85
you can use []
or use add-type -AssemblyName "System.example"
to use assembly for example use :
[system.drawing]::class ...