Trevor Sullivan's Tech Room

Minding the gap between administration and development

PowerShell: Disabling Task Sequence ProgramFlags

Posted by Trevor Sullivan on 2009/11/11

If you are using Microsoft ConfigMgr 2007, you may be familiar with the ProgramFlags bit that controls the “Allow this program to be installed from the Install Software task sequence without being advertised” setting on a Program configuration. Someone on the MyITforum “mssms” mailing list recently asked how to disable this setting for all SMS programs on a given primary site server. The PowerShell code below should take care of the job for you. Please keep in mind that I have not tested this code, and am providing it only for convenience.

$SiteCode = '123'
$SccmServer = 'sccmserver'
$progs = Get-WmiObject -ComputerName $SccmServer -Namespace "root\sms\site_$SiteCode" -Class SMS_Program
$progs | ? { $_.ProgramFlags -band 1 } | % { $_.ProgramFlags -bxor 1; $_.Put() }

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

%d bloggers like this: