Posts

Showing posts with the label Running PowerShell Commands

Day-5: PowerShell Modules & PSSnapin

Image
Introduction One of the PowerShell's primary Strengths is its extensibility. As Microsoft continues to invest in PowerShell, it develops more and more commands for products like Exchange, SharePoint Server, System Center Family, SQL Server and so on. Typically when you install these product's Management tools, you also get a graphical management console of some kind and one or more extensions for Windows PowerShell. How IT Works You all are familiar with the graphical Microsoft Management Console (MMC), same management team within Microsoft develops both the MMC and PowerShell Modules (or Snap-in) for particular MMC. When you open a new, blank MMC console you add Snap-in like DNS, Active Directory Users and Computer.    PowerShell works in almost exactly the same way. Install the management tools for a given product, doing so will give you any related PowerShell extensions, and it may even create a product specific management she. These Product ...

DAY-4: PowerShell Pipeline and Exporting Data

Image
Pipeline - Connecting commands   PowerShell connects commands to each other using something called a Pipeline. The pipeline provides a way for one command to pass, or pipe, its output to another command, allowing that second command to have something to work with. The concept of joining commands is not limited to PowerShell, but PowerShell takes the same piping to a greater extend for better effect.  Exporting Output to Files 1. Get-Process 2. Get-service When we run above commands, a table with several columns of information appears on the screen.  It's great to have information on the screen, but that isn't all you might want to do with the information. For example, if you want to export the information into a CSV file that could be read into an application like Microsoft excel.  Exporting to CSV Exporting to a file is where the pipeline and a second command come in handy. Get-Process | Export-csv C:\procs...

DAY-3: Running PowerShell Cmdlets

Image
PowerShell: Running Commands Powershell, as its name implies, is a shell. It's similar to Cmd.exe command line that you probably used previously. It also has a strong resemblance to the Unix shells, like Bash or even original Unix Bourne shell. Only the difference come with PowerShell commands with all the other shells is that PowerShell has a unique Anatomy of the Cmdlets structure, which is missing in other shells.This structure is very easy to understand and make use while running Cmdlets. Now I will make you understand the anatomy of the Cmdlets in PowerShell. The Anatomy of PowerShell Command The figure shows the basic anatomy of a complex PowerShell command. I have tried to use a complex command so that you can all of the different things that might show up. Now we will tell you all few rules for writing PowerShell commands. 1. Cmdlets Naming Convention - Microsoft has established a naming convention for Cmdlets. The rule is this: Names start with a...