My First PowerShell Script

So after installing the windows powershell in your machine, let's start with your first scripting step.

1. Open the PowerShell in Administrative ISE mode, for that search powershell ISE, right click then run as admin, put on your domain credentials and then press enter or if it does not asks for your credentials then simply click "Yes". It would take 1 min to load up ISE.

2. Goto Script Pane and then try with below script:

Get-Service -Name *server* | Select-Object StatusStartType, NameDisplayName | Sort-Object StartType | Format-Table -AutoSize

The above script would provide you list of services on which service name contains server. It would also provide you Status (Running or Not Running), StartType (Automatic, Manual or Disabled), service name and it's display name of the service.

Syntax:
cmdlet -Property <Property Name>

Every command-let has it's property and you may use these properties according to your requirements. You may check the property of the command-let using below script:

Get-Service | Get-Member | Select-Object Name, MemberType | Where-Object MemberType -EQ Property | Format-Table -AutoSize


Comments

Popular posts from this blog

Command-Lets and Module

PowerShell and 'Get-Help' Basics

Getting started with Powershell