Powershell help for SCCM

Welcome Forums General PowerShell Q&A Powershell help for SCCM

This topic contains 4 replies, has 3 voices, and was last updated by

 
Participant
1 year, 8 months ago.

  • Author
    Posts
  • #66799

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 270
    Helping Hand
    Rank: Contributor

    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

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 1
    Rank: Member

    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

      Participant
      Points: 0
      Rank: Member

      Thanks Graham ,

      Will check and confirm if that works

The topic ‘Powershell help for SCCM’ is closed to new replies.