} } $size=("{0:N2}"-f ($subFolderItems.sum /1GB)) 保留小数点后两位$size=[math]::truncate($disk.size/1GB) 截取小数点,保留整数 $date=get-date).TOSTRING("yyyy-dd-MM")$servers= get-adcomputer -Filter{Name-Like"GAGA*"-orName-Like"WENDY*"} -SearchScope Subtree -SearchBase"DC=WEND...
$DBLogFile = Get-Counter -Counter '\MSSQL$SQL2K8_01:Databases(*)\Log File(s) Size (KB)' -MaxSamples 1$DBLogFile.CounterSamples | where-object -FilterScript {($_.InstanceName -ne "_total")} | sort-object -Property InstanceName | format-table @{Label = "Database"; Expression={...
PS C:\> dir *.txt | Get-FileSize processing: digit.txt processing: largetext.txt processing: smalltext.txt processing: test.txt processing: test2.txt 19083很多情况下,在处理管道输入时仅需要定义process段,如过滤进程的集合并只显示启动不超过5分钟的进程等。为此需要定义Get-RecentlyStarted函数,在proces...
# 指定文件路径$filePath="C:\path\to\your\file.txt"# 定义支持的哈希算法列表$hashAlgorithms=@("SHA256","MD5","SHA1","SHA384","SHA512")# 遍历算法列表,为每种算法计算哈希值foreach($algorithmin$hashAlgorithms) {$hash=Get-FileHash-Path$filePath-Algorithm$algorithmWrite-Output"$algorithmhash ...
(Unblock-File is in PSv3 and up) before extracting, and copy to a module folder (see $Env:PSModulePath). Or use the PowerShell Gallery if you have PSv5+ (see below). When you use the module, the function that's exported is named "Get-STFolderSize", not "Get-FolderSize" (to ...
"KERNEL32!GETFILESIZE" = $global:g_doingIO;"KERNEL32!GETFILESIZEEX" = $global:g_doingIO;"KERNEL32!GETFULLPATHNAME" = $global:g_doingIO;"KERNEL32!GETTEMPFILENAME" = $global:g_doingIO;"KERNEL32!GETTEMPPATH" = $global:g_doingIO;"KERNEL32!LOCKFILE" = $global:g_doingIO;...
This function has a $Size parameter. The function displays all the files that are smaller than the value of the $Size parameter, and it excludes directories: PowerShell Copy function Get-SmallFiles { Param($Size) Get-ChildItem $HOME | Where-Object { $_.Length -lt $Size -and !$_.PSIs...
Drop this script into a directory in your path, and you can quickly find the sizes for directories in your file system. Remember that it outputs objects, so you can add tasks such as sort and filter, for example: Get-DirStats -Path C:\Temp | Sort-Object -Property Size This command ou...
Get-AdminAuditLogConfig | FL UnifiedAuditLogIngestionEnabled UnifiedAuditLogestionEnabled 属性的 True 值表明已打开审核日志搜索。 必须在 Exchange Online 中为用户分配“仅查看审核日志”或“审核日志”角色,才能成功运行脚本。 默认情况下,这些角色是在 Exchange 管理中心中的“权限”页上被分配给“合规性管理...
Get-DirectorySize. The total size of a folder cannot be known, if all of the content is not known. The file count and subfolder count will, however, follow the path of the-Recurseparameter. Furthermore, since the Average File Size depends on the number of files found, the reported ...