(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-ObjectName,$size,$daysName Size(KB) Days --- --- --- Certificate.format.ps1xml12.5244140625223Diagnostics.Format.p...
Select-Object 参考 模块: Microsoft.PowerShell.Utility 选择对象或对象属性。 语法 PowerShell复制 Select-Object[-InputObject <PSObject>] [[-Property] <Object[]>] [-ExcludeProperty <String[]>] [-ExpandProperty <String>] [-Unique] [-CaseInsensitive] [-Last <Int32>] [-First <Int32>] [-Skip...
$property= @{ Name ='TotalSpaceGB'Expression = { ($_.Used +$_.Free) /1GB } } CmdletName會為該數據行加上標籤。Expression是執行的腳本區塊,其中$_是管道上 物件的值。 以下是作用中的文稿: PowerShell $drives=Get-PSDrive| where Used$drives|Select-Object-PropertyName,$propertyName TotalSpaceGB...
gt 0 and usageDate ge$StartDateand usageDate lt$EndDate"## Join extended printer info with the printer usage report$reportWithPrinterNames=$printerReport|Select-Object( @{Name ="UsageMonth"; Expression = {$_.Id.Substring(0,8)}}, @{Name ="PrinterId"; Expression = {$_.PrinterId}}, ...
# 监控磁盘使用情况(可用空间、已使用空间等) Get-Volume | Select-Object DriveLetter, FileSystemLabel, @{Name="UsedSpace(GB)";Expression={$_.SizeUsed/1GB}}, @{Name="FreeSpace(GB)";Expression={$_.SizeRemaining/1GB}} # 生成磁盘使用情况报告 Get-Volume | Format-Table DriveLetter, FileSystemLa...
Get-PrintJob -PrinterName "打印机名称" | Group-Object -Property UserName | Select-Object Name, @{Name='作业数'; Expression={$_.Count}} | Sort-Object 作业数 -Descending 这个命令将按用户分组打印作业,并按打印作业数量降序排列。 9. 配置打印机偏好设置 通过PowerShell脚本配置打印偏好设置,如双面打...
() }$groupResult=$groupResult|Sort-ObjectTotalMilliseconds$groupResult|Select-Object*, @{ Name ='RelativeSpeed'Expression = {$relativeSpeed=$_.TotalMilliseconds /$groupResult[0].TotalMilliseconds$speed= [Math]::Round($relativeSpeed,2).ToString() +'x'if($speed-eq'1x') {$speed}else{$speed+...
Invoke-Expression(IEX的别名):用来把字符串当作命令执行。 WindowStyle Hidden(-w Hidden):隐藏窗口...
Get-ChildItem ~\AppData\Local\Microsoft\WindowsApps\MicrosoftEdge.exe | Select-Object Mode, LinkTarget, LinkType, Name Mode LinkTarget LinkType Name --- --- --- --- la--- MicrosoftEdge.exe 目前,Windows 不提供用于获取 AppX 重新分析点的目标信息的方法。 LinkTarget 和LinkType 文件系统对象的...
Select-Object Substring Blank Hello, thank you for you assistance in advance. I'm trying to grab the last 10 characters of the Directory. For some reason it's returning blank, and I'm not able to figure out why. Below is what ...Show More Windows PowerShell Like 0 Reply LainRobertson...