Vbscript: Modify packages to be available on package share ConfigMgr2012

In some scenarios in Configuration Manager 2012 you want your packages, OS images, boot image and driver packages, well everything you use in a task sequence to be available on the package share so that we can use the option to access the content directly during OS deployment.
This of course takes up more disk space but makes the OS deployment a little bit faster.

Here is the setting in question:

packageshare1

I got a question today if you could script that setting, so after a little bit of WMI browsing I found the value that needs to changed, as I couldn’t find it in the SDK for Configuration Manager 2012, maybe I wasn’t looking hard enough.

However here is a code snippet that you can use together together with the example on MSDN on how to call an example snippet: http://msdn.microsoft.com/en-us/library/hh949053.aspx.

Sub ModifyPackageFlags(connection, existingPackageID)

' Define a constant with the hex value for USE_PKGSHARE.

CONST USE_PKGSHARE = "&H00000080"

' Get the specific advertisement instance to modify.

Set packageToModify = connection.Get("SMS_Package.PackageID='" & existingPackageID & "'")

' List the existing property values.

Wscript.Echo " "

Wscript.Echo "Values before change: "

Wscript.Echo "--------------------- "

Wscript.Echo "Package Name: " & packageToModify.Name

Wscript.Echo "Package Flags: " & packageToModify.PkgFlags

' Set the new property value.

packageToModify.PkgFlags = packageToModify.PkgFlags OR USE_PKGSHARE

' Save the advertisement.

packageToModify.Put_

' Output the new property values.

Wscript.Echo " "

Wscript.Echo "Values after change: "

Wscript.Echo "--------------------- "

Wscript.Echo "Package Name: " & packageToModify.Name

Wscript.Echo "Package Flags: " & packageToModify.PkgFlags

End Sub

2 Comments

Add a Comment

Your email address will not be published. Required fields are marked *