Get the App
SLTechnology News&Howtos  ›  Servers  › 

Getting started with powershell

Shulou Source: shulou.com Published: 2022-06-03 09:19:30 10月01日 Update

Use Get-Date in PowerShell to get the date and time and format the output

Https://www.jb51.net/article/53282.htm

Other in-depth learning links

Https://www.jb51.net/article/63887.htm

Https://www.jb51.net/list/list_234_1.htm

# # there is a cmdlet of Get-Date in PowerShell, which can be used to return the current date and time directly. Use the-Format parameter to return the current year, month, day, hour, minute, second, and so on. Yyyy M / d / h / 24 / m minutes / s # # PS H:\ > Get- date July 17, 2019 19:17:30PS H:\ > Get-Date-format yyyyMMdd20190717 example if you have heard of PowerShell for the first time and want to wait and see a little, let's take a look at the following 10 examples. [mathematical calculation] (39079-51) * 497 Universe 28 =? No matter how fast the mental arithmetic is, it should not be as fast as hitting the enter key: PS > (39th 79-51) * 497pm 281189.25 [date] how many minutes are there before the next Valentine's Day? I know how many days away is easy to calculate, what if it becomes minutes? $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? can PS > 3gb-gt 3145726kbTrue [ID] produce a GUID? PS > [guid]:: NewGuid () Guid----0f283ab4-f402-400c-98ce-359442f11f1a [File] what is the size of all executable files exe in the Windows directory? Dir $env:windir-Filter * .exe | measure-Sum Length [registry] what is the value of 'Enable64Bit'' under the registry path HKEY_LOCAL_MACHINE\ SOFTWARE\ Microsoft\ .NET Framework? (Get-ItemProperty-Path hklm:SOFTWARE\ Microsoft\ .NET Framework) .is a certificate with a fingerprint of [28DE15612AFF1CD69596AB17AF06AE86CB9C003B] in the certificate store? Ls Cert:\ LocalMachine\ My\ | where {$_ .Thumbprint-eq '28DE15612AFF1CD69596AB17AF06AE86CB9C003B'} has the printer service been started? Get-Service spooler [process] how many IE processes are currently running? (Get-Process iexplore) .count [report] exports all running process information as a HTML report? Get-Process | ConvertTo-Html | Out-File a.html now knows the power of powershell. Powershell is relatively easy to use on the windows platform.

Tags: Hour date certificate process report file time registry service run powerful example information parameter enter key size capacity platform lover printer Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn MySQL Microsoft Huawei Shulou Technology