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
Next
Here is the script to do the same thing in PowerShell:
Get-Service
Which would you rather memorize?
Comments
Anonymous
May 06, 2010
A rather trivial example since sc query would do the same thing...Anonymous
May 06, 2010
sc query works but the results of that are quite static. Also gsv is even shorter!Anonymous
May 06, 2010
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. :-)