What is the Deal with PowerShell?

What's the deal with PowerShell?

Here is the VBScript code to list services:

strComputer = "."

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colServiceList = objWMIService.ExecQuery("Select * from Win32_Service")

For Each objService in colServiceList

wscript.echo objService.name


Here is the script to do the same thing in PowerShell: 


Which would you rather memorize?

Comments (3)
  1. jeremy says:

    A rather trivial example since sc query would do the same thing…

  2. troth says:

    sc query works but the results of that are quite static. Also gsv is even shorter!

  3. John says:

    more importantly, the vbs script ejected a text stream, the powershell cmdlet actually returned an object, that happened to then be redendered to text for display purposes.  

    that’s the real power, everything is an object.   🙂

Comments are closed.

Skip to main content