AddDays(双精度值)添加指定天数。 AddHours(双精度值)添加指定小时数。 AddMinutes(双精度值)添加指定分钟数。 AddMonths(整数月份)添加指定月数。 AddYears(整数值)添加指定年份。 ToLongDateString()以字符串形式返回长格式的日期。 ToShortDateString()以字符串形式返回短格式的日期。
Get-Date [[-Date] <DateTime>] [-Year <Int32>] [-Month <Int32>] [-Day <Int32>] [-Hour <Int32>] [-Minute <Int32>] [-Second <Int32>] [-Millisecond <Int32>] [-DisplayHint <DisplayHintType>] [-Format <String>] [-AsUTC] [<CommonParameters>]Power...
Get-Date_Func: Cannot process argument transformation on parameter 'Date'. Cannot convert value "19-06-2018" to type "System.DateTime". Error: "String '19-06-2018' was not recognized as a valid DateTime." 有关详细信息,请参阅关于类型转换。静态...
$targetGpo - The GPO name of the GPO to add # : $targetDomain - The dns name, such as microsoft.com, of the domain where the copy should be put # : $migrationTable - The path to an optional Migration table to use when copying the GPO # Returns : N/A # Dependencies: Uses Get...
Get-WinEvent[-MaxEvents <Int64>] [-ComputerName <String>] [-Credential <PSCredential>] [-FilterXml] <XmlDocument> [-Oldest] [<CommonParameters>] 说明 此cmdlet 仅在 Windows 平台上可用。 Get-WinEventcmdlet 从事件日志(包括经典日志)获取事件,例如系统和应用程序日志。 该 cmdlet 从 Windows Vista ...
$original = [pscustomobject] @{ Timestamp = Get-Date Label = 'Meeting event' } $original | Add-Member -MemberType ScriptMethod -Name GetDisplay -Value { '{0:yyyy-MM-dd HH:mm} {1}' -f $this.Timestamp, $this.Label } $original | Get-Member -MemberType ScriptMethod TypeName: Syst...
:IsNullOrEmpty($Book.Title)) {throw"$PrefixTitle wasn't defined"}if([string]::IsNullOrEmpty($Book.Author)) {throw"$PrefixAuthor wasn't defined"}if([datetime]::MinValue-eq$Book.PublishDate) {throw"$PrefixPublishDate wasn't defined"} }# Static methods to manage the list of books.# Add...
static [void] Validate([book]$Book) { $Prefix = @( 'Book validation failed: Book must be defined with the Title,' 'Author, and PublishDate properties, but' ) -join ' ' if ($null -eq $Book) { throw "$Prefix was null" } if ([string]::IsNullOrEmpty($Book.Title)) { throw "$...
$start = Get-Date $end = Get-Date # Perform the Audit search looking for Power BI Pro Trials. # This is for a given date range. Useful for automation. $PowerBIAudits = Search-UnifiedAuditLog -StartDate $start.ToShortDateString() -EndDate $end.AddDays(1).ToShortDateString(...
$userobject|Add-Member-membertype noteproperty -Name 距离密码过期天数 -Value$expire_days $userlist+=$userobject } } $EmailbodyHTML=$userlist| sort-object距离密码过期天数 | ConvertTo-Html| Out-String Send-Mailmessage-from"it@contoso.com"–to “itmanager@contoso” -Bodyashtml$EmailbodyHTML-Su...