Thank you, I just want to query it though.

So, how do I turn this line into just a ‘show me programs that are currently 
disabled?’

       #Check if it's disabled and enable it:
       if ($ProgramFlagsVal -band $PROGRAM_DISABLED) {$ProgramFlagsVal -= 
$PROGRAM_DISABLED}


From: [email protected] [mailto:[email protected]] On 
Behalf Of Bradnan, Jerry
Sent: Monday, August 12, 2013 8:14 AM
To: [email protected]
Subject: RE: [mssms] SCCM 2012 query for enabled programs

I have used this to change that value during migrations. See if this code 
snippet will give you what you need:

$Programs = [Add code to get programs list]

#Program Flags Values
$AUTHORIZED_DYNAMIC_INSTALL = 0x00000001
$USECUSTOMPROGRESSMSG = 0x00000002
$DEFAULT_PROGRAM = 0x00000010
$DISABLEMOMALERTONRUNNING = 0x00000020
$MOMALERTONFAIL = 0x00000040
$RUN_DEPENDANT_ALWAYS = 0x00000080
$WINDOWS_CE = 0x00000100
$COUNTDOWN = 0x00000400
$PROGRAM_DISABLED = 0x00001000
$UNATTENDED = 0x00002000
$USERCONTEXT = 0x00004000
$EVERYUSER = 0x00010000
$NOUSERLOGGEDIN = 0x00020000
$OKTOQUIT = 0x00040000
$OKTOREBOOT = 0x00080000
$USEUNCPATH = 0x00100000
$PERSISTCONNECTION = 0x00200000
$RUNMINIMIZED = 0x00400000
$RUNMAXIMIZED = 0x00800000
$HIDEWINDOW = 0x01000000
$OKTOLOGOFF = 0x02000000
$ANY_PLATFORM = 0x08000000
$SUPPORT_UNINSTALL = 0x20000000
$PLATFROMNOTSUPPORTED = 0x40000000

Foreach ($ProgObj in $Programs) {
    Write-Host $ProgObj.PackageID $ProgObj.PackageName $ProgObj.ProgramName 
$ProgObj.

       #Convert to Lazy Property Handling
       $Prog = [WMI]$ProgObj.__PATH

       #Make a temp var to hold the current flags:
       $ProgramFlagsVal = $Prog.ProgramFlags
       #Write-Host 'Current setting = ' $ProgramFlagsVal

       #Check if it's disabled and enable it:
       if ($ProgramFlagsVal -band $PROGRAM_DISABLED) {$ProgramFlagsVal -= 
$PROGRAM_DISABLED}

       #And then set the flags back on the program, and write it:
       #enable these two line to apply the new value
       #$Prog.ProgramFlags = $ProgramFlagsVal
       #$Prog.Put()

       }


From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Daniel Ratliff
Sent: Monday, August 12, 2013 9:47 AM
To: [email protected]<mailto:[email protected]>
Subject: RE: [mssms] SCCM 2012 query for enabled programs

Yeah it looks like that column was incorrect. You want programflags.

Get-WmiObject -ComputerName louappwps875 -namespace root\sms\site_Cas -class 
sms_program | select packageid,programflags

But this doesn’t really tell you whether its enabled or not. This is where you 
would have to convert it.

I would stick with the SQL query instead!

Daniel Ratliff

From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]] On Behalf Of Adam, Debora
Sent: Monday, August 12, 2013 9:09 AM
To: [email protected]<mailto:[email protected]>
Subject: RE: [mssms] SCCM 2012 query for enabled programs

Daniel, that’s pretty sweet – but the Status field shows blank-whether or not 
the program is enabled. Is there another field to check?

Debora Adam
IT Client Infrastructure
ATK Aerospace Systems Group
[email protected]<mailto:[email protected]>
Office 435-863-3547
Mobile 435-452-1625



From: [email protected]<mailto:[email protected]> 
[mailto:[email protected]]<mailto:[mailto:[email protected]]>
 On Behalf Of Daniel Ratliff
Sent: Friday, August 09, 2013 3:22 PM
To: '[email protected]'
Subject: RE: [mssms] SCCM 2012 query for enabled programs

With WMI and PowerShell you can do:

Get-wmiobject -namespace root\sms\site_$sitecode -class sms_package 
-computername $siteserver | select packageid,status

Just full out the $ variables with your info.

I'll check it on a pc in a bit and fix the few syntax errors I probably have.

-Daniel Ratliff

-----Original Message-----
From: Adam, Debora [[email protected]<mailto:[email protected]>]
Sent: Friday, August 09, 2013 04:52 PM Eastern Standard Time
To: [email protected]<mailto:[email protected]>
Subject: [mssms] SCCM 2012 query for enabled programs
I’m looking for a query or report that shows a list of programs that are 
‘enabled.’ We have a bunch of programs we migrated over that are not enabled by 
default.

Any of you folks have something like that set up already?

Thanks,

Debora Adam
IT Client Infrastructure
ATK Aerospace Systems Group
[email protected]<mailto:[email protected]>
Office 435-863-3547
Mobile 435-452-1625



The information transmitted is intended only for the person or entity to which 
it is addressed
and may contain CONFIDENTIAL material. If you receive this material/information 
in error,
please contact the sender and delete or destroy the material/information.



The information transmitted is intended only for the person or entity to which 
it is addressed
and may contain CONFIDENTIAL material. If you receive this material/information 
in error,
please contact the sender and delete or destroy the material/information.



Reply via email to