Rolling Review: Windows 2008 Server PowerShell

We set out to determine whether PowerShell is usable, and learnable, for the masses of Windows admins who prefer to point and click their way through daily tasks.

Randy George, Director, IT Operations, Boston Red Sox

April 24, 2008

2 Min Read

10 Cool Things To Do With PowerShell

1. NUMBERS, PLEASE
Return only the serial number and version of the BIOS of your system, collected from the Win32_BIOS class
Get-WMIObject Win32_BIOS | Select-Object SerialNumber,Version 2. STATE OF THE UNION
List the services running on the PC; select and display service name and running state
Get-WMIObject Win32_Service | Select-Object Name,State 3. MAIL CALL
List services running on a remote system named "email"; select and display service name and running state
Get-WMIObject Win32_Service -computername email | Select-Object Name,State 4. RECENT HISTORY
Query and return the 100 most recent events in the system log for any events of type "Warning"
Get-eventlog -newest 100 -logname system | where-object {$_.entry Type -eq "Warning"} 5. KILL SWITCH
Kill the Excel process running on the local computer
Get-Process | Where { $_.Name -Eq "Excel" } | Kill 6. TESTING 1,2
Use WSMan to remotely execute the Get-Service Cmdlet on a host called "testPC"
Invoke-expression -command "Get-Service" -ComputerName testPC 7. ON THE RUN
Use WSMan to list all running processes on a remote host called "test PC"
invoke-expression -command "Get-Process" -ComputerName testPC 8. NINJA MAN
Use WSMan to remotely kill the Excel process on a host called "testPC"
invoke-expression -command "Stop-Process -processnameExcel" -ComputerName testP 9. STOP THE PRESSES
Remotely stop the print spooler service on a host called "testPC"
invoke-expression -command "Stop-Service -displayname 'Print Spooler'" -Computer- Name testPC 10. AT YOUR SERVICE
One of our favorites, this two-line command exports a list of all services to a csv file, and then launches Excel to display the data
Get-Service | Export-CSV c:\Processes.csv < enter > Invoke-Item c:\Processes.csv

Read more about:

20082008

About the Author(s)

Randy George

Director, IT Operations, Boston Red Sox

Randy George has covered a wide range of network infrastructure and information security topics in his 4 years as a regular InformationWeek and Network Computing contributor. He has 13 years of experience in enterprise IT, and has spent the last 8 years working as a senior-level systems analyst and network engineer in the professional sports industry. Randy holds various professional certifications from Microsoft, Cisco and Check Point, a BS in computer engineering from Wentworth Institute of Technology and an MBA from the University of Massachusetts Isenberg School of Management.

Never Miss a Beat: Get a snapshot of the issues affecting the IT industry straight to your inbox.

You May Also Like


More Insights