The Windows operating system and Office Office software were so excellent that Microsoft was not named Poweros and Poweroffice, but in the second year after the release of Monad (the predecessor of PowerShell) (2006), Microsoft has just released Windows PowerShell 1.0, and "shamelessly" named PowerShell, which is a bit too uncomfortable.
Today I have a little summary of why PowerShell is so powerful, based on my experience.
An unprecedented convenience
such as GB,MB,KB units in the storage calculation; 1 in the array declaration: N and subscript is the processing of-1, as well as some WYSIWYG, easy-to-understand verb + noun structure cmdlet.
Object oriented
Compared to the process, the object-oriented more convenient and easier to describe the real world, but also to catch up with the fashionable.
Tied up. NET this big tree
The so-called tree under the good shade, PowerShell tied to the. NET this rich, with the. NET Framework platform a powerful class library, almost everything is possible.
Powerful compatibility
Fully compatible with other calls on the Windows platform, such as executable files (EXE), batch bat, and VB script.
Platform-based scalability
Microsoft has the advantage that it prefers to be a platform when compared to applications. PowerShell has already become a platform, and in the second year of PowerShell's release, Microsoft's system Center Operations Manager and SharePoint provided components for that platform, later Active Directory, Hyper-V, Let alone the Windows azure,office 365. In addition to Microsoft, Amazon's Cloud platform management, Dell's Out-of-hand management, also provides PowerShell-based management components. PowerShell has become a standard, becoming a norm.
Example Introduction
If you've heard of PowerShell for the first time, want to look at it a little bit and see the 10 examples below.
- [Mathematical calculation] (39+79-51) *497/28 =?
If you do it fast, you should not hit the ENTER key quickly:
12 |
PS> (39+79-51)*497/28 1189.25 |
- [Date] How many minutes from the next Valentine's Day?
I know how many days to calculate the distance, if it becomes a minute?
12345678 |
$now
=
Get-Date
$day
=
[datetime]
‘2-14‘
if
(
$now -lt $day ){
$day
.Subtract(
$now
).TotalMinutes
}
else
{
$day
.AddYears(1).Subtract(
$now
).TotalMinutes
}
|
- [Capacity] 3GB > 3145726KB?
12 |
PS> 3gb -gt 3145726kb True |
- can [ID] produce a GUID?
12345 |
PS> [guid] ::NewGuid() Guid ---- 0f283ab4-f402-400c-98ce-359442f11f1a |
- File What is the size of all executable exe files in the Windows directory?
1 |
dir $env:windir -Filter *.exe | measure -Sum Length |
- [Registry] Registry Path HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\. What is the value of netframework under ' Enable64bit '?
1 |
( get-itemproperty -path hklm:software\microsoft\. NETFramework). Enable64bit |
- is the [certificate] thumbprint of [28de15612aff1cd69596ab17af06ae86cb9c003b] Certificate in the certificate store?
12 |
ls Cert:\LocalMachine\My\ | where { $_ .Thumbprint -eq ‘28DE15612AFF1CD69596AB17AF06AE86CB9C003B‘ } |
- Does the [Service] printer service start?
- How many IE processes are currently running on [process]?
1 |
( Get-Process iexplore ).count |
- [Report] Exports all running process information as an HTML report?
1 |
Get-Process | ConvertTo-Html | Out-File a.html |
Why PowerShell is powerful