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:
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
Hi, great snippet, it got me on the right track.
I found that for me, it falls over with driver packages. I replaced this line…
packageToModify.PkgFlags = packageToModify.PkgFlags OR USE_PKGSHARE
with these lines…
Err.Clear
On Error Resume Next
Set packageToModify = swbemServices.Get(“SMS_Package.PackageID='” & objResource.ReferencePackageID & “‘”)
If Err.Number 0 Then
Set packageToModify = swbemServices.Get(“SMS_DriverPackage.PackageID='” & objResource.ReferencePackageID & “‘”)
End If
Cheers!
Simon.
Hi, Great! Thanks for the update, will use it as well.