Windows PowerShell



Windows PowerShell is a command-line shell and scripting language designed especially for system administration. Its analog in Linux is called Bash Scripting. 

Built on the .NET Framework, Windows PowerShell helps IT professionals to control and automate the administration of the Windows operating system and applications that run on the Windows Server environment. 

Windows PowerShell commands, called cmdlets, let you manage the computers from the command line. Windows PowerShell providers let you access data stores, such as the Registry and Certificate Store, as easily as you access the file system. In addition, Windows PowerShell has a rich expression parser and a fully developed scripting language. 

So in simple words, you can complete all the tasks that you do with GUI and much more.

A cmdlet or "Command let" is a lightweight command used in the Windows PowerShell environment. The Windows PowerShell runtime invokes these cmdlets at command prompt.

How to Start Windows PowerShell

From the Start Menu Click Start, type PowerShell, and then click Windows PowerShell

or

From the Start menu, click Start, click All Programs, click Accessories, click the Windows PowerShell folder, and then click Windows PowerShell.

Some Basic Commands in Windows Powershell 

get-date
get-location
get-localuser
get-process
get-service
get-help eg: get-help process

ConvertTo-Html 

The ConvertTo-Html cmdlet converts .NET Framework objects into HTML that can be displayed in a Web browser. You can use this cmdlet to display the output of a command in a Web page.

Example: Create a web page to display processes
Get-Process | ConvertTo-Html -Property Name, Path, Company -Title "Process Information" | Out-File proc.htm; ii proc.htm

Additional Commands (cmdlet)

You can  find the list of updates installed on the machine using the following command: 
Get-Hotfix

To get the version of the PowerShell, use the following command: 
Get-host | select Version

To get the reboot history : 



Get-EventLog system | where-object {$_.eventid -eq 6006} | select -last 10

List of Installed programs: 

Get-Module PSWindowsUpdate 

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize

Finding the rules on the firewall: 
Get-NetFirewallRule

IP configuration: 
Get-NetIPConfiguration

To verify if IPv4 or IPv6 is enabled or not 
Get-NetAdapterLso

To get the routing table 
Get-NetRoute

List of Installed Programs
Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize



Windows PowerShell

Windows PowerShell



Windows PowerShell is a command-line shell and scripting language designed especially for system administration. Its analog in Linux is called Bash Scripting. 

Built on the .NET Framework, Windows PowerShell helps IT professionals to control and automate the administration of the Windows operating system and applications that run on the Windows Server environment. 

Windows PowerShell commands, called cmdlets, let you manage the computers from the command line. Windows PowerShell providers let you access data stores, such as the Registry and Certificate Store, as easily as you access the file system. In addition, Windows PowerShell has a rich expression parser and a fully developed scripting language. 

So in simple words, you can complete all the tasks that you do with GUI and much more.

A cmdlet or "Command let" is a lightweight command used in the Windows PowerShell environment. The Windows PowerShell runtime invokes these cmdlets at command prompt.

How to Start Windows PowerShell

From the Start Menu Click Start, type PowerShell, and then click Windows PowerShell

or

From the Start menu, click Start, click All Programs, click Accessories, click the Windows PowerShell folder, and then click Windows PowerShell.

Some Basic Commands in Windows Powershell 

get-date
get-location
get-localuser
get-process
get-service
get-help eg: get-help process

ConvertTo-Html 

The ConvertTo-Html cmdlet converts .NET Framework objects into HTML that can be displayed in a Web browser. You can use this cmdlet to display the output of a command in a Web page.

Example: Create a web page to display processes
Get-Process | ConvertTo-Html -Property Name, Path, Company -Title "Process Information" | Out-File proc.htm; ii proc.htm

Additional Commands (cmdlet)

You can  find the list of updates installed on the machine using the following command: 
Get-Hotfix

To get the version of the PowerShell, use the following command: 
Get-host | select Version

To get the reboot history : 



Get-EventLog system | where-object {$_.eventid -eq 6006} | select -last 10

List of Installed programs: 

Get-Module PSWindowsUpdate 

Get-ItemProperty HKLM:\Software\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize

Finding the rules on the firewall: 
Get-NetFirewallRule

IP configuration: 
Get-NetIPConfiguration

To verify if IPv4 or IPv6 is enabled or not 
Get-NetAdapterLso

To get the routing table 
Get-NetRoute

List of Installed Programs
Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize