Powershell help for SCCM

This topic contains 4 replies, has 3 voices, and was last updated by  Arun Pachehra 1 year, 2 months ago.

  • Author
  • #66799

    Arun Pachehra

    HI ,

    Please help me find out below via Powershell.

    How could we remove all the machine from the list of Device Collections inside a folder ?

    How could we find : how many "Always Re-run program" running in SCCM ?


  • #66801

    Olaf Soyk

    Your question is a bit vague ... sorry if that sounds rude for you but did you try to type this questions in your favorite search engine? SCCM comes with a specialized Powershell module and it's possible to achive what you're asking for but we cannot write your scripts for you. You should come back when you have a specific question about a particular issue you have with code you wrote.

  • #67660

    Arun Pachehra

    HI Everyone ,

    Below code is regarding the Deployment Settings in SCCM. We have multiple deployments enable with setting "Always Re-Run" on multiple collections and we need to change that setting to "Failed if re-run" for all the deployments. Below code helps me to change that by changing the remoteclient Flag value. Now the bigger task is we need to change that on all the deployment which has "Always Re-run" and i am unable to build the loop. Please help me here :-

    get-CimInstance -Namespace 'Root\sms\site_cas' -Class 'sms_advertisement' |
    Where-Object {$_.remoteclientflags -eq ($_.remoteclientflags -bor 0x800)} |
    Set-CimInstance -Property @{remoteclientflags = (0x8830 – 0x0800)+ 0x1000}


  • #67663

    Graham Beer

    Hi Arun,

    I've not tested it, but something like this should work:

    get-CimInstance -Namespace 'Root\sms\site_cas' -Class 'sms_advertisement' | foreach {
        if ($_.remoteclientflags -eq ($_.remoteclientflags -bor 0x800)) {
             Set-CimInstance -Property @{remoteclientflags = (0x8830 – 0x0800)+ 0x1000}
    • #67678

      Arun Pachehra

      Thanks Graham ,

      Will check and confirm if that works

You must be logged in to reply to this topic.