Powershell help for SCCM

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

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.

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,

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}
    }
}

Thanks Graham ,

Will check and confirm if that works