Accessing .NET components from Powershell


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?


If you want to load an assembly into your PowerShell session, you can use reflection and load the assembly.


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. :)

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.

By : EBGreen

I'm with Eli. Writing against firefox (with firebug installed) makes you have to write "more compatible" code to begin with and then its less of a job later down the line when you come to make it compatible with IE.

Use the site QuirksMode to help you find answers to compatbility information

This video can help you solving your question :)
By: admin