Files
Intune/dump/temp/collection-membership.ps1

20 lines
762 B
PowerShell

$Dev = "w2012a","w2012b"
$Temp = @()
$Dev | % { $S = $_
$W = (Get-WmiObject -ComputerName pncrasccm001 -Namespace root\SMS\site_ccx -Query "SELECT SMS_Collection.* FROM SMS_FullCollectionMembership, SMS_Collection where name = '$S' and SMS_FullCollectionMembership.CollectionID = SMS_Collection.CollectionID").name
$W | % {
$Obj = New-Object -TypeName PSObject
$Obj | Add-Member -MemberType NoteProperty -Name Server -Value $S
$Obj | Add-Member -MemberType NoteProperty -Name Collection -Value $_
$Obj
$Temp += $Obj
}
}#end%
#$Collections | select name