Szukaj na tym blogu

czwartek, 17 marca 2016

SCCM get collection members name and MAC address

$SiteServer = 'server'
$SiteCode = 'XXX'
$CollectionName = 'DeviceColl*'

$Collections = Get-WmiObject -ComputerName $SiteServer -Namespace  "ROOT\SMS\site_$SiteCode" -Class SMS_Collection | where {$_.Name -like "$CollectionName"}

foreach ($Collection in $Collections){
    $SMSClients = Get-WmiObject -ComputerName $SiteServer -Namespace  "ROOT\SMS\site_$SiteCode" -Query "SELECT * FROM SMS_FullCollectionMembership WHERE CollectionID='$($Collection.CollectionID)' order by name" | select *
    foreach ($SMSClient in $SMSClients){
        $ClientName = $SMSClient.Name
        $ClientMAC = (Get-WmiObject -Class SMS_R_SYSTEM -ComputerName $SiteServer -Namespace root\sms\site_$SiteCode | where {$_.Name -eq "$ClientName"}).MACAddresses
        $SMSClient.Name + ", " + $ClientMAC + ", " + $Collection.Name | out-file -append C:\list.txt
    }
}

SCCM create collection using PowerShell

New-CMDeviceCollection -Name "TestMAC" -LimitingCollectionName "All Systems"

$q1='SELECT SMS_R_System.Name, SMS_R_System.MACAddresses FROM  SMS_R_System WHERE SMS_R_System.MACAddresses="00:12:5f:0e:b3:10"'

Add-CMDeviceCollectionQueryMembershipRule -CollectionName "testMAC" -RuleName "q1" -QueryExpression $q1

Invoke-CMDeviceCollectionUpdate -CollectionId


czwartek, 10 marca 2016

sccm client actions trigger by wmi

PsExec.exe /accepteula /e \\computername WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000001}" /NOINTERACTIVE


SCCM client action name
WMIC command used to trigger specific action
Hardware Inventory
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000001}" /NOINTERACTIVE
Software Inventory
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000002}" /NOINTERACTIVE
Discovery Inventory
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000003}" /NOINTERACTIVE
File Collection
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000010}" /NOINTERACTIVE
IDMIF Collection
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000011}" /NOINTERACTIVE
Request Machine Assignments
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000021}" /NOINTERACTIVE
Evaluate Machine Policies
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000022}" /NOINTERACTIVE
Refresh Default MP Task
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000023}" /NOINTERACTIVE
LS (Location Service) Refresh Locations Task
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000024}" /NOINTERACTIVE
LS (Location Service) Timeout Refresh Task
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000025}" /NOINTERACTIVE
Software Metering Generating Usage Report
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000031}" /NOINTERACTIVE
Source Update Message (Software Deployment)
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000032}" /NOINTERACTIVE
Machine Policy Agent Cleanup
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000040}" /NOINTERACTIVE
Policy Agent Validate Machine Policy / Assignment
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000042}" /NOINTERACTIVE
Retrying/Refreshing certificates in AD on MP
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000051}" /NOINTERACTIVE
Software Updates Assignments Evaluation Cycle
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000108}" /NOINTERACTIVE
Send Unsent State Message
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000111}" /NOINTERACTIVE
State System policy cache cleanout
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000112}" /NOINTERACTIVE
Scan by Update Source
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000113}" /NOINTERACTIVE
Update Store Policy
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000114}" /NOINTERACTIVE
State system policy bulk send low
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000116}" /NOINTERACTIVE
AMT Status Check Policy
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000120}" /NOINTERACTIVE
Application manager policy action
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000121}" /NOINTERACTIVE
Power management start summarizer
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000131}" /NOINTERACTIVE
Endpoint deployment reevaluate
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000221}" /NOINTERACTIVE
Endpoint AM policy reevaluate
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000222}" /NOINTERACTIVE
External event detection
WMIC /namespace:\\root\ccm path sms_client CALL TriggerSchedule "{00000000-0000-0000-0000-000000000223}" /NOINTERACTIVE