Add current date to email subject line Add custom AD attribute to user depending on parent OU Add Custom Function to Runspace Add data to existing CSV column with foreach loop add date to filename Add digital signature to multiple files Add domain user as sysadmin in SQL Server 2012 using ...
Get-Date|Get-Member-MemberTypeProperty-Static Output复制 TypeName: System.DateTime Name MemberType Definition --- --- --- MaxValue Property static datetime MaxValue {get;} MinValue Property static datetime MinValue {get;} Now Property datetime Now {get;} Today Property datetime Today {get;} ...
括号运算符按该顺序强制计算 Get-Date cmdlet 和 cmdlet 表达式的计算 New-TimeSpan -Day 1。 然后使用 运算符添加 + 这两个结果。PowerShell 复制 Get-Process | Where-Object { ($_.ws * 2) -gt 50mb } 输出 复制 Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName --- -...
$cert=New-SelfSignedCertificate-CertStoreLocationCert:\CurrentUser\My-FriendlyName'test-vaultcredentials'-subject"Windows Azure Tools"-KeyExportPolicyExportable-NotAfter$(Get-Date).AddHours(48)-NotBefore$(Get-Date).AddHours(-24)-KeyProtectionNone-KeyUsageNone-TextExtension@("2.5.29.37={text}1.3.6.1...
$days = @{l="Days";e={((Get-Date) - $_.LastAccessTime).Days}} # You can also shorten the name of your label key to 'l' and your expression key # to 'e'. Get-ChildItem $PSHOME -File | Select-Object Name, $size, $days Name Size(KB) Days --- --- --- Certificate.format...
To add statements to the function, type each statement on a separate line, or use a semicolon ; to separate the statements. For example, the following function finds all .jpg files in the current user's directories that were changed after the start date. PowerShell Copy function Get-New...
StatusCode : 200 StatusDescription : OK Content : { "headers": { "Host": "httpbin.org", "If-Match": "12345", "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Microsoft Windows 10.0.19044; en-US) PowerShell/7.2.5", "X-Amzn-Trace-Id": � RawContent : HTTP/1.1 200 OK Date: ...
add-firewall-rules.ps1 Adds firewall rules for executables, needs admin rights. Read more » check-cpu.ps1 Checks the CPU temperature. More » check-dns.ps1 Checks the DNS resolution. More » check-drive-space.ps1 Checks a drive for free space left. More » check-file-system.ps1 ...
Dir | Where-Object { $_.CreationTime -gt (Get-Date).AddDays(-14) } 1. 文件系统导航 除非你通过前面介绍的方式更改了PowerShell控制台的提示信息,否则你工作的当前目录会在控制台的命令行开头显示。你也可以使用Get-Location或别名pwd命令获取当前工作的目录。 PS C:\PowerShell> Get-Location Path ---...
$initScript = { param ($compressor) $compressor.CustomParameters.Add("mt", "off") } Compress-7Zip -Path . -ArchiveFileName demo.7z -CustomInitialization $initScript A list of all custom parameters can be found here. Changelog [v2.7] Updates of 7-Zip libraries to version 24.09 (contributed...