First published on TECHNET on Apr 09, 2009
WINDOWS POWERSHELL (BASIC COMMANDS)
Description: Windows PowerShell is a command line shell and scripting language that helps IT professionals achieve greater control and productivity in their environment. Using an admin-focused scripting language, more than 130 standard command line tools, and consistent syntax and utilities, Windows PowerShell allows IT professionals to more easily control system administration and accelerate automation. Windows PowerShell is easy to adopt, learn, and use, because it works with your existing IT infrastructure and existing script investments. PowerShell works on Windows XP, Windows 2003, Windows Vista, Windows 2008 and Windows 7.
Scoping the Issue: First, PowerShell needs to be downloaded and installed on your OS. If you are running Windows Server 2008, or Windows 7 then PowerShell is already included with the Operating System. To install PowerShell on other supported operating systems, please follow this link below: How to Download Windows PowerShell 1.0 .
Once PowerShell is installed, the following basic commands can be used to gather data:
- Get-help - displays help about PowerShell cmdlets and concepts
- Get-process – gets the processes that are running on the local computer
- Stop-process - stops one or more running processes
- Get-service – gets the services on the local computer
- Start-service – starts one or more stopped services
- Stop-service – stops one or more running services
- Get-eventlog – gets information about local event logs or the entries stored in those event logs
- Get-wmiobject <classname> - gets instances of WMI classes or information about available classes
These commands represent a fraction of the native PowerShell commands.
Data Gathering: In all instances, collecting either MPS Reports with the General, Internet and Networking, Business Networks and Server Components diagnostics, or a Performance-oriented MSDT manifest must be done. PowerShell records any errors to the Event Logs with an Event Source of PowerShell.
Additional Resources:
- PowerShell main page
- Windows PowerShell Blog
- AskPerf Blog: Getting Started with Windows PowerShell
- Windows PowerShell 1.0 Document Pack
- What’s new in Windows PowerShell (Version that comes with Windows 7)
- Microsoft KB Article 941660: Windows PowerShell 1.0 does not work correctly with custom locales or with programs that prevent Windows PowerShell 1.0 from accessing the root of each file system drive in Windows Vista, in Windows Server 2003, and in Windows XP
- Microsoft KB Article 944332: User Creation via PowerShell Did Not Succeed When Using LoadGen on Exchange Server 2007
- Microsoft KB Article 949536: PowerShell commands for the Exchange 2007 Edge server role do not work as expected after you uninstall an update rollup or an interim update on the Edge server
Updated Mar 16, 2019
Version 2.0CraigMarcho
Microsoft
Joined March 15, 2019
Ask The Performance Team
Follow this blog board to get notified when there's new activity