Have you ever wanted to select a group of applications or packages in ConfigMgr and find out the total size of the content files for all those packages? Or maybe you have your packages organised into folders in the ConfigMgr console, and you want to find out the total content size of all the packages in that folder? Well with PowerShell you can!
I wrote this script to help me in calculating the content size for multiple packages of any type I choose – applications, standard packages, driver packages, boot images etc, so that I know how much data I am sending across the wire when distributing packages to a new distribution point. If your network bandwidth to a distribution point is limited, then it is helpful to know how much data you are sending so you know whether you need to set rate limits, or distribute out of hours etc.
This script uses PowerShell’s handy Out-GridView to display the list of available packages for the package types found in the Software Library (you choose) and allow you to select multiple packages. It will then calculate the total size of all the packages you selected. If you use the -Verbose option, it will also report the size of each individual package.
For Applications, Standard Packages and Driver Packages, which are often organised into sub-folders in the ConfigMgr console, you can also specify the folder name, and the script will return the total content size of all packages in that folder.
The following package types are supported:
- Applications (Specific console folder supported)
- Standard Packages (Specific console folder supported)
- Driver Packages (Specific console folder supported)
- Software Update Packages
- OS Image Packages
- Boot Image Packages
Get the script
Download from the Technet Gallery here.
Configure the script
The script has two parameters that you might want to set the defaults for, otherwise you will need to enter them each time:
- $SiteServer – the name of the site server you are running the script on
- $SiteCode – your Site code
Edit the following part of the script:
[Parameter( Mandatory=$False, HelpMessage="The Site Server name" )] [string]$SiteServer="mysccmserver", [Parameter( Mandatory=$False, HelpMessage="The Site Code" )] [string]$SiteCode="ABC"
The script also has comment-based help.
Get the total content size of all Adobe Flash Player Applications
I run the script with the -Applications switch:
Select the Adobe Flash Player applications and click OK:
Total content size is returned:
Get the total size of all Intel packages and also report the size of each package
I run the script with the -Packages and the -Verbose switches:
Get-CMSelectedSoftwareContentSizes.ps1 -Packages -Verbose
Select the Intel packages and click OK:
Total size and individual sizes are returned:
Get the total size of all Dell driver packages in the “Dell System Cab Driver Packages” console folder and report the size of each package
In the ConfigMgr console, I have Dell driver packages organised into a subfolder:
I run the script and use the -DriverPackages, -FolderName and -Verbose switches:
Get-CMSelectedSoftwareContentSizes.ps1 -DriverPackages -FolderName “Dell System Cab Driver Packages” -Verbose
The individual size and total size of all driver packages in that console folder is returned:
One thought on “Calculate the Size of Multiple Packages in ConfigMgr with PowerShell”
Is there an easy way to export the results to csv? I tried just doing a simple pipe and export-csv but it didn’t work.