Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: PowerShell: A beginner's guide, (Review)  (Read 3460 times)

0 Members and 1 Guest are viewing this topic.

Geek-9pm

    Topic Starter

    Mastermind
  • Geek After Dark
  • Thanked: 978
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows XP
PowerShell: A beginner's guide, (Review)
« on: November 06, 2016, 03:34:30 PM »
Last month PC World published this article.

How to use Windows PowerShell: A beginner's guide


Here is why I  recommend the article.

The article was written by Woody Leonhard Senior Contributing Editor. Woody Leonhard is a senior contributing editor at InfoWorld and author of dozens of Windows books.
At the end of the short tutorial about Powershelll, he gives a list of where to look for more information, so you will know where to go next.
The code examples are short commands. Most are just lone line commands.This makes it easy for even the very new student. There are examples that can be be helpful for all of us. Here is just one:
Code: [Select]
get-help get-childitem -examples...produces seven detailed examples of how to use get-childitem.
Another:
Quote
get-childitem “HKLM:\Software”
returns a list of all of the high-level registry keys in
HKEY_LOCAL_MACHINE\Software.
He includes some screen shots of  what to expect.

If you already are a Powershell user, read the article anyway and recommend it-to your friends who have yet to try Powershell.
Hope you like the recommendation.   :)

DaveLembke



    Sage
  • Inventor of the Magna-Broom 3000 =)
  • Thanked: 608
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 7
Re: PowerShell: A beginner's guide, (Review)
« Reply #1 on: November 07, 2016, 06:19:32 AM »
Kind of surprised they had an article on powershell which has been around for quite some time.

https://en.wikipedia.org/wiki/PowerShell ( 10 years )

Geek-9pm

    Topic Starter

    Mastermind
  • Geek After Dark
  • Thanked: 978
    • Gekk9pm bnlog
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows XP
Re: PowerShell: A beginner's guide, (Review)
« Reply #2 on: November 07, 2016, 10:45:10 AM »
DaveLembke, it is notable that some computer science teachers want students to learn  the DOS batch file commands when they ought to teach Powershell.

BC_Programmer


    Mastermind
  • Typing is no substitute for thinking.
  • Thanked: 1087
    • Yes
    • Yes
    • BC-Programming.com
  • Certifications: List
  • Computer: Specs
  • Experience: Beginner
  • OS: Windows 8
Re: PowerShell: A beginner's guide, (Review)
« Reply #3 on: November 07, 2016, 01:04:55 PM »
"Computer Science" teachers shouldn't be having students work in e ither batch or Powershell. That is the domain of IT administration, not Computer science.

Even for administration purposes Powershell's position can be dubious.

it is often regarded as a Windows equivalent for Bash, but it is nowhere near the flexibility of Bash; where Bash and other Linux CLI interfaces adhere strictly to a paradigm where everything is effectively a text stream, Powershell deals in discrete objects. it's "paradigm" is that you send objects around to other cmdlets and hope they understand the specific strong types that you are sending around as boxed arrays.

As a prime example, get-childitem returns a generic object array:

Code: [Select]
PS C:\>(get-childitem "HKLM:\Software").GetType()

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     Object[]                                 System.Array


But the actual types of each element change depending on the argument. In this case the specific Type of each array element is a boxed Microsoft.Win32.RegistryKey:

Code: [Select]
PS C:\> (get-childitem "HKLM:\Software")[2].GetType()

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     False    RegistryKey                              System.MarshalByRefObject


But enter a file path, and suddenly it's no longer the case. It's still a Array of Objects, but now it contains two different types. FileInfo and DirectoryInfo, as it returns the directories and Files in the given path. Both can be handled as a System.IO.FileSystemInfo of course but strong typing IMO has no place in a shell interface.

Code: [Select]
PS C:\> (get-childitem "C:\")[0].GetType()

IsPublic IsSerial Name                                     BaseType
-------- -------- ----                                     --------
True     True     DirectoryInfo                            System.IO.FileSystemInfo


Personally I think Powershell is a poor shell interface because it attempts to be a .NET Language, but it also makes a poor scripting/batch language because it intentionally exposes itself as effectively a programming environment and thus shares very little syntax with other shell interfaces, nor with other .NET languages. It's not an  equivalent to Bash as much as it is an entirely new shell language that uses a completely different paradigm entirely from Bash, so the comparison is so invalid as to be useless.




I was trying to dereference Null Pointers before it was cool.