The meat of it is pretty easy. Also note this only shows task sequences.
$resid = $global:computercas.resourceid
$collmem = Get-WMIObject -ComputerName $global:siteservercas -Namespace
"root\sms\site_$global:sitecodecas" -class sms_fullcollectionmembership -Filter
"resourceid = '$resid'" -Credential $global:sccmcred
foreach ($coll in $collmem) {
$collid = $coll.collectionid
$adverts = Get-WMIObject -ComputerName $global:siteservercas -Namespace
"root\sms\site_$global:sitecodecas" -class sms_advertisement -filter
"collectionid = '$collid'" -Credential $global:sccmcred
foreach ($advert in $adverts) {
$pkgid = $advert.packageid
$ts = Get-WMIObject -ComputerName $global:siteservercas -Namespace
"root\sms\site_$global:sitecodecas" -class sms_tasksequencepackage -filter
"PackageID = '$pkgid' and PackageType = '4'" -Credential $global:sccmcred
if ($ts -ne $null) {
$tslist = $tslist + $ts.Name
}
}
}
Daniel Ratliff
From: [email protected] [mailto:[email protected]] On
Behalf Of Andreas Hammarskjöld
Sent: Wednesday, February 17, 2016 10:14 AM
To: [email protected]
Subject: [mssms] RE: Getting Deployments per machine
Cook, new there was some scripts out there but didnt know it was doable from
PowerShell.
How do you do it? (Or do I have to parse all that PS? ;-)
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Daniel Ratliff
Sent: den 17 februari 2016 16:11
To: [email protected]<mailto:[email protected]>
Subject: [mssms] RE: Getting Deployments per machine
Yeah I have that functionality in my OSD FrontEnd. It's all PowerShell called
from WinPE.
http://www.potentengineer.com/powershell-osd-frontend-2-0/
Daniel Ratliff
From: [email protected]<mailto:[email protected]>
[mailto:[email protected]] On Behalf Of Andreas Hammarskjöld
Sent: Wednesday, February 17, 2016 10:05 AM
To: [email protected]<mailto:[email protected]>
Subject: [mssms] Getting Deployments per machine
Hey peeps,
Ok, so the same old crap;
Adding a new machine with PowerShell to a collection with a deployment and then
wanting to know when the deployment has been created so that we can PXE boot.
How do I do this? Can I even do this from PowerShell? Or do I have to dig into
SQL land?
//Andreas
The information transmitted is intended only for the person or entity to which
it is addressed
and may contain CONFIDENTIAL material. If you receive this material/information
in error,
please contact the sender and delete or destroy the material/information.
The information transmitted is intended only for the person or entity to which
it is addressed
and may contain CONFIDENTIAL material. If you receive this
material/information in error,
please contact the sender and delete or destroy the material/information.