How To: List Packages that are Configured to use a Package Share in ConfigMgr 2012

Here’s a sample script to display all packages that have the option enabled to “Copy the content in this package to a package share on distribution points.”

get-cmpackage | foreach {
  if ($_.pkgflags -eq ($_.pkgflags -bor 0x80)) {
  "pkg share bit enabled on {0}" -f $_.Packageid

To run the script, launch PowerShell from your ConfigMgr Admin Console, or import the ConfigMgr module, and paste it into the command screen or run it as a .ps1 file.  As you can see, we run get-cmpackage to query for all packages on the ConfigMgr site. You will noticed that get-cmpackage may take some time to run in an environment with a large number of packages, because it is also querying the lazy properties for each package. Next we run a for-each loop to check the package flags. We then use the bitwise operator -bor to compare the current pkgflags value to see if the value 0x80 has already been applied, and display a message if it finds the checkbox enabled.

You can find more information about pkgflags on msdn.

For reference, here’s the setting on the package:

Happy Scripting,




About Greg Ramsey
Greg Ramsey is a Distinguished Engineer for Dell Digital - Services. He has a B.S. in Computer Sciences and Engineering from The Ohio State University and has co-authored many books over the years. Greg is also a board member of the Northwest System Center User Group and the Midwest Management Summit. ​Greg has been a Microsoft Endpoint Manager (ConfigMgr, Intune) MVP for over 14 years.

2 Responses to How To: List Packages that are Configured to use a Package Share in ConfigMgr 2012

  1. MikhailCompo says:

    This script is useful thanks greg – However, it is very very slowwwwwww

    Is there any way to improve performance on our 600 packages?!

    • Greg Ramsey says:

      Yes. You can query wmi directly.

      Just replace LAB with your sitecode, and myLAB with the site server name.

      gwmi sms_package -Namespace root\sms\site_LAB -ComputerName myLAB | foreach {
      if ($_.pkgflags -eq ($_.pkgflags -bor 0x80)) {
      “pkg share bit enabled on {0}” -f $_.Packageid

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: