Powershell help for SCCM

This topic contains 4 replies, has 3 voices, and was last updated by  Arun Pachehra 5 months, 3 weeks ago.

  • Author
    Posts
  • #66799

    Arun Pachehra
    Participant

    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 ?

    Thanks

  • #66801

    Olaf Soyk
    Participant

    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
    Participant

    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}

    Thanks,

  • #67663

    Graham Beer
    Participant

    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
      Participant

      Thanks Graham ,

      Will check and confirm if that works

You must be logged in to reply to this topic.