For quite a while now, I’ve been thinking about creating a PowerShell script to help with identifying Package or Task Sequence deployment settings, for instance if any of the deployments have been configured to run directly from the Distribution Point or which deployments are configured to always re-run. As with ConfigMgr 2012, it’s now called deployments (previously advertisements in ConfigMgr 2007). But the SMS Provider class that holds the instances of deployed packages or task sequences, is still called SMS_Advertisement. If you’ve explored this class in the SMS Provider before, you may be familiar with two properties in particular. These two properties are the RemoteClientFlags and AdvertFlags. If you want to dig deeper into these two, you can read more about them on MSDN. What we essentially want is to decode the decimal value present in each of these properties, to retrieve the objects which have the particular setting we’re looking for configured or enabled.

As an example, let’s say that you’re trying to identify what deployments that have been configured to always Re-run. Before I go ahead and demonstrates how the script works, please go ahead and download it first.

Download the script

The script can be downloaded from the TechNet Gallery.

How to use it

As for most of my previous scripts I’ve put on this blog, I may not have followed all the PowerShell best-practices out there. But I’m learning and trying to do my best in that regard. Anyhow, download the script from the TechNet Gallery link above, extract the Get-AdvertisementSettings.ps1 from the ZIP-file and put it in e.g. C:\Scripts. As we said earlier, in this example we’re trying to see what deployed packages or task sequences that have the Always re-run setting enabled.

1. Open an elevated PowerShell console and browse to C:\Scripts.
2. Run the following command:

.\Get-AdvertisementSettings.ps1 -SiteServer CAS01 -Property RemoteClientFlags -RemoteClientFlag RERUN_ALWAYS

112_1

As you can see from the output of the script, I had three objects in my ConfigMgr environment that was deployed and had the always re-run setting enabled. In this case it’s, always enabled for a task sequence, but if you’d like to check other settings, here’s a complete list of properties that you can specify and their value (copied from MSDN):

RemoteClientFlags

0x00000008 (3) RUN_FROM_LOCAL_DISPPOINT

Run the program from the local distribution point.

0x00000010 (4) DOWNLOAD_FROM_LOCAL_DISPPOINT

Download the program from the local distribution point.

0x00000020 (5) DONT_RUN_NO_LOCAL_DISPPOINT

Do not run the program if there is no local distribution point.

0x00000040 (6) DOWNLOAD_FROM_REMOTE_DISPPOINT

Download the program from the remote distribution point.

0x00000080 (7) RUN_FROM_REMOTE_DISPPOINT

Run the program from the remote distribution point.

0x00000100 (8) DOWNLOAD_ON_DEMAND_FROM_LOCAL_DP

Download the program on demand from the local distribution point. This is only applicable for task sequences.

0x00000200 (9) DOWNLOAD_ON_DEMAND_FROM_REMOTE_DP

Download the program on demand from the remote distribution point. This is only applicable for task sequences.

0x00000400 (10) BALLOON_REMINDERS_REQUIRED

Balloon reminders are required.

0x00000800 (11) RERUN_ALWAYS

Always rerun the program.

0x00001000 (12) RERUN_NEVER.

Never rerun the program.

0x00002000 (13) RERUN_IF_FAILED

Rerun the program if execution previously failed.

0x00004000 (14) RERUN_IF_SUCCEEDED

Rerun the program if execution previously succeeded.

0x00008000 (15) PERSIST_ON_WRITE_FILTER_DEVICES

This information applies only to System Center 2012 Configuration Manager SP1 and System Center 2012 R2 Configuration Manager.

0x00010000 (16) ENABLE_PEER_CACHING

This information applies only to System Center 2012 Configuration Manager SP1 and System Center 2012 R2 Configuration Manager.

0x00020000 (17) DON’T_FALLBACK

This information applies only to System Center 2012 Configuration Manager SP1 and System Center 2012 R2 Configuration Manager.

0x00040000 (18) DP_ALLOW_METERED_NETWORK

This information applies only to System Center 2012 Configuration Manager SP1 and System Center 2012 R2 Configuration Manager.

AdvertFlags

0x00000020 (5) IMMEDIATE

Announce the advertisement to the user immediately.

0x00000100 (8) ONSYSTEMSTARTUP

Announce the advertisement to the user on system startup.

0x00000200 (9) ONUSERLOGON

Announce the advertisement to the user on logon.

0x00000400 (10) ONUSERLOGOFF

Announce the advertisement to the user on logoff.

0x00008000 (15) WINDOWS_CE

The advertisement is for a device client.

0x00020000 (17) DONOT_FALLBACK

Do not fall back to unprotected distribution points.

0x00040000 (18) ENABLE_TS_FROM_CD_AND_PXE

The task sequence is available to removable media and the pre-boot execution environment (PXE) service point.

0x00100000 (20) OVERRIDE_SERVICE_WINDOWS

Override maintenance windows in announcing the advertisement to the user.

0x00200000 (21) REBOOT_OUTSIDE_OF_SERVICE_WINDOWS

Reboot outside of maintenance windows.

0x00400000 (22) WAKE_ON_LAN_ENABLED

Announce the advertisement to the user with Wake On LAN enabled.

0x00800000 (23) SHOW_PROGRESS

Announce the advertisement to the user showing task sequence progress.

0x02000000 (25) NO_DISPLAY

The user should not run programs independently of the assignment.

0x04000000 (26) ONSLOWNET

Assignments are mandatory over a slow network connection.

I hope this will help you in any way!

Nickolaj Andersen
Principal Consultant and Enterprise Mobility MVP. Nickolaj has been in the IT industry for the past 10 years specializing in Enterprise Mobility and Security, Windows deployments and Automation. In 2015 Nickolaj was awarded as PowerShell Hero by the community for his script and tools contributions. Author of ConfigMgr Prerequisites Tool, ConfigMgr OSD FrontEnd, ConfigMgr WebService and a frequent speaker at user groups.

(65)

There are no comments.

Leave a Reply