Here you go Nick.
$CollectionIDs = (Get-WmiObject -ComputerName <siteserver> -Namespace
root/SMS/site_<sitecode> -Query "SELECT * FROM SMS_FullCollectionMembership
WHERE Name='<hostname>'").CollectionID
Foreach ($ID in $CollectionIDs) {
$Collections = (Get-WmiObject -ComputerName <siteserver> -Namespace
root/SMS/site_<sitecode> -Class SMS_Collection -Filter "CollectionID='$ID'")
$CollectionName = $Collections.Name
Write-Host $CollectionName
}
On Thu, Apr 16, 2015 at 8:54 PM, Paul Winstanley <[email protected]>
wrote:
> Will sort soon Nick
>
>
>
> On 16 Apr 2015, at 20:45, Nick sullivan <[email protected]>
> wrote:
>
> I'm finding out getting the names will be a lot more helpful. My Sr.
> Desktop Engineer is trying to write a script to help with our
> uninstall automation process. Any info you have please let me know.
>
> Thanks,
>
> ------------------------------
> Subject: Re: [mssms] SCCM script to get all collection memberships
> From: [email protected]
> Date: Thu, 16 Apr 2015 17:08:56 +0100
> To: [email protected]
>
> I'll send through how to get the names from the ids later if you want.
> Just commuting home
>
>
>
> On 16 Apr 2015, at 17:01, Nick sullivan <[email protected]>
> wrote:
>
> Wow that was easy. Thanks,
>
> ------------------------------
> Date: Thu, 16 Apr 2015 16:52:11 +0100
> Subject: Re: [mssms] SCCM script to get all collection memberships
> From: [email protected]
> To: [email protected]
>
> TBH that will give you the collection IDs.
>
> On Thu, Apr 16, 2015 at 4:48 PM, Paul Winstanley <[email protected]>
> wrote:
>
> Get-WmiObject -ComputerName <site server> -Namespace
> root/SMS/site_<sitecode> -Query "SELECT * FROM SMS_FullCollectionMembership
> WHERE Name='<hostname>'"
>
>
> On Thu, Apr 16, 2015 at 4:37 PM, Nick sullivan <
> [email protected]> wrote:
>
> Anybody aware of a Powershell script I can run to get collection
> memberships of a computer using SCCM WMI Queries not the SCCM Commandlets.
>
>
>
>
>
>
>
>
>
>
>
>
>