Want to learn more

Team,

I m not from programming / coding background, but after learning and using PS, I just fall in love of coding. I found that I m good at coding. My brain process codes more faster. But the limitation is I know only powershell. Whenever I m looking for solutions in forums, I used to see people use classes and methods, type accelerators etc. I also use those when I see how peole use it. Yes, its true I m not able to use them at one chance, I have to look for more and more information using multiple forum, then I can figure out something.

Now my question to you is, I want to learn these things. I know PS use dot net framework, but I can’t find the point from where I should start. I think if I can learn the framework, I can do more better. Could you please guide me how should I proceed?

Regards

Sankhadip Roy.

There are a few books you should consider getting.

PowerShell Month Of Lunches & PowerShell Scripting Month of Lunches

those are a great start, but I have a personal favorite module that I’ve been using called ‘PSKoans’, give that a shot and you’ll start learning a lot more quickly by example.

“Learning the framework” is a very, very broad thing indeed. There’s enough in there to last a few lifetimes, I’m sure. Not all of it will be useful to your purposes specifically, as there are a lot of specialized tools.

I’ve found it actually a bit easier to look for information on how to do things in other languages that have a more direct interaction with .NET framework on occasion, and then translating that to how it can be used in PowerShell. C# is pretty close to PowerShell in terms of syntax in most cases, so if I can’t find a cmdlet for it, I’ll often look to see if there are existing solutions or tools that are recommended for C#, and then port that to PowerShell. That said, examples of how to do things purely in PS are getting quite a bit more common.

Take a look at these discussions.

https://www.reddit.com/r/PowerShell/comments/ar6cvt/powershell_in_depth_second_edition/egmlpom/?context=3 https://www.reddit.com/r/PowerShell/comments/afqmmw/i_want_to_help_my_husband_advance_his_powershell/ee3k6p6/?context=3

PowerShell is often referred to as a gateway drug to C#, so, jump on that band wagon.

Get ramped up on PowerShell classes, well, classes in general.

YouTube - by Trevor Sullivan https://www.youtube.com/results?search_query=PowerShell+classes+Trevor+sullivan

Dig at the namespaces and the like. Start here:

<#
 Get any .NET types and their static methods from PowerShell. 
 Enumerate all that are currently loaded into your AppDomain.
#>  
[AppDomain]::CurrentDomain.GetAssemblies() | 
foreach { $_.GetTypes() } | 
foreach { $_.GetMethods() } | 
where { $_.IsStatic } | 
select DeclaringType, Name | 
Out-GridView -PassThru -Title '.NET types and their static methods'

Query and come to know the Powershell Data Types

[AppDomain]::CurrentDomain.GetAssemblies() | 
Foreach-Object {
    $_.GetExportedTypes()
}

Or

[psobject].Assembly.GetType("System.Management.Automation.TypeAccelerators")::Get.GetEnumerator() | 
sort Key
https://blogs.technet.microsoft.com/heyscriptingguy/2013/07/08/use-powershell-to-find-powershell-type-accelerators

If you want to know what type something is, you can use introspection in the form of

$Object.GetType().FullName, $Object.Property.GetType().FullName, $Object | Get-Member, or $Object | Get-Member -Static

View the MSDN docs on the topic,

https://docs.microsoft.com/en-us/dotnet/api/index?view=netframework-4.7.2

BTW there is a very large library you can buy for offline use if you are really wanting to dig at this.

Example:
https://www.amazon.com/s?k=.net+framework+1.1&amp;ref=nb_sb_noss_2
… it’s a bit dated but I still find them useful in the case I needed to look at them.

Applied Microsoft® .NET Framework Programming (Developer Reference)

Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries (Microsoft Windows Development Series)