From 0db67a6d7020d51f7c5f4f4b2432d8a12faee506 Mon Sep 17 00:00:00 2001 From: Przemyslaw Klys Date: Thu, 17 Oct 2024 19:30:15 +0200 Subject: [PATCH] Add file size --- Private/Get-XMLGPO.ps1 | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Private/Get-XMLGPO.ps1 b/Private/Get-XMLGPO.ps1 index 3012ab5..0ca6529 100644 --- a/Private/Get-XMLGPO.ps1 +++ b/Private/Get-XMLGPO.ps1 @@ -220,12 +220,14 @@ # if there are any, then we can't say that GPO is empty, and they are not visible in the XML $GPFFile = $false $FilesCount = 0 + $TotalSize = 0 Get-ChildItem -LiteralPath $SysvolGpoPath -Recurse -ErrorAction SilentlyContinue -File | ForEach-Object { if ($_.Extension -eq '.gpf') { #Write-Warning -Message "Get-XMLGPO - GPO [$DisplayName/$DomainName] has no data in XML, but it contains GPF files. Excluding from empty GPO list." $GPFFile = $true } $FilesCount++ + $TotalSize += $_.Length } if ($ComputerSettingsAvailable -eq $false -and $UserSettingsAvailable -eq $false -and $GPFFile -eq $false) { @@ -363,6 +365,8 @@ 'Problem' = $Problem 'ApplyPermission' = $null 'Exclude' = $Exclude + 'SizeMB' = [Math]::Round($TotalSize / 1MB, 2) + 'Size' = $TotalSize 'Description' = $GPO.Description 'ComputerPolicies' = $XMLContent.GPO.Computer.ExtensionData.Name -join ", " 'UserPolicies' = $XMLContent.GPO.User.ExtensionData.Name -join ", "