Is there a convenient method to access .NET class documentation (i.e. the MSDN documentation) from within PowerShel similar to "man 3" in UNIX shells?
The addition of classes enables developers and IT professionals to embrace PowerShell for a wider range of use cases. It simplifies development of PowerShell artifacts and accelerates coverage of management surfaces. A class declaration is a blueprint used to create instances of objects at run time.
PowerShell has the capability to create .Net Framework classes using the Add-Type cmdlet. To create classes, the C# language can be used to define the classes. C# is part of Visual Studio, but having Visual Studio is not necessary to create classes for use in PowerShell.
It is always a best practice, to use a native Windows PowerShell cmdlet when it exists unless there is a good reason for not doing so. One such example is using a static method within a .NET class. To determine the power of a number we make use of System.Math class and use the method Pow
Firstly you need to download .dll into powershell session: [System.Reflection.Assembly]::LoadFile("c:\script ame.dll") Share Improve this answer Follow answered May 29 '17 at 12:37 Mihail KuznesovMihail Kuznesov 51622 silver badges1212 bronze badges 2 Add-Type -AssemblyNameis the preferred way to load .Net assemblies. – vonPryz
In the Powershell Community Extensions 2.0 (still only available via daily builds), we extend Get-Help to add a -object parameter that, in conjunction with -online, will bring up MSDN documentation e.g.:
Get-Help -object (get-date) -online
Until we release a 2.0 beta (in a few weeks), grab the module file from here. Note that it requires features in PowerShell 2.0. Import this module like so:
Import-Module .\Pscx.GetHelp.psm1
Note that you can't use this on a namespace like System.Net but pick a type like System.Net.WebClient e.g.:
Get-Help -obj [System.Net.WebClient] -online
BTW, gives props to x0n (Oisin) for implementing this for PSCX.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With