Script to get hostsnames from Collection in specified Status

Hello, i am quite new in scripting.
i have an script in powershell to read from MECM (SCCM), based on
$Variable = Get-CMSoftwareUpdateDeployment -CollectionName $CollectionName | Where-Object { $_.ApplicationName -eq $ADR }
Adr is an Automaticdeploymentrule for windowsupdates.
I can filter and create an customobject, based on the resulting $Variable.
But how to filter Hostnames, which are in Status “Unknown” “Process” and “Error”?
Thanks for your support
Eddie

eddie,
Welcome to the forum. :wave:t3:

Before we start … When you post code, sample data, console output or error messages please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.

Thanks in advance

Guide to Posting Code - Redux <---- Click :point_up_2:t4: :wink:

( !! Sometimes the preformatted text button hides behind the settings gear symbol. :wink: )

I wonder that you get something in return at all. I don’t get a property ApplicationName when I run Get-CMSoftwareUpdateDeployment. :man_shrugging:

Hello Olaf, thanks for the reply
you need the module ConfigurationManager, and need to connect your powershell session to the sms site. All cmd-lets for configuratiomanager needs to be done under location of the sms_site

I know all that. :smirking_face:

What I mean is that the return object I get when I run Get-CMSoftwareUpdateDeployment does not have a property ApplicationName.

Sorry, you need an parameter -summary
</>$Variable = Get-CMSoftwareUpdateDeployment -CollectionName $CollectionName -Summary | Where-Object { $_.ApplicationName -eq $ADR }

image

OK, that returns the property. :+1:

Since I never needed a query like this so far I googled it and found this:

3 Likes

Thanks i will go through, the part with
</>Get-CMDeploymentStatusDetails with the deployment summary object
looks promising, i will give it an try

Thanks a lot, this works exactly how it need it. Why didn’t i find this article on my search :sad_but_relieved_face:

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.