MSEndpointMgr / ConfigMgr

Microsoft Endpoint Configuration Manager scripts and tools
634 stars 281 forks source link

Invoke-CMApplyDriverPackage.ps1 Enhancement: "Verify" mode #229

Open beanska opened 4 years ago

beanska commented 4 years ago

For Invoke-CMApplyDriverPackage.ps1 it would be helpful to have a something like

Invoke-CMApplyDriverPackage.ps1 ... -DeploymentType Verify

that sets a variable if an applicable driver is found. This could be run early on in the TS or in a front end to stop the TS if a driver is not yet available for a model. Apologies if this is already possible. I would be happy to start working on it if there is interest.

merlinfrombelgium commented 4 years ago

I would argue that this can be done through the -Debugmode parameter.

Example: .\Invoke-CMApplyDriverPackage.ps1 -URI "http://CM01.domain.com/ConfigMgrWebService/ConfigMgr.asmx" -SecretKey "12345" -Filter "Drivers" -DebugMode -TSPackageID "P0100001"

You can run this outside of the TS, such as in the frontend phase. You could then parse the log for results.

beanska commented 4 years ago

@merlinfrombelgium This might do the trick.

beanska commented 4 years ago

@merlinfrombelgium so I started down this road and then realized that DebugMode is going to prevent setting TS variables. How would you recommend I get the availability status of a driver out of the script when running in DebugMode inside a task sequence?

merlinfrombelgium commented 4 years ago

Just found a notification on your last comment. Sorry it took this long.

First off, make sure you try v4 of the invoke script. It uses new parameters and the ConfigMgr Admin Service. If that's something you can't yet use for some reason, stick to v3.

I would recommend you use the Run PowerShell Script step in a Task Sequence and store the output in a variable, then parse it for the info you want and use it to build a condition. Or you could adapt the code in the Script step to only output the info you want and store that in a variable. I see more than one possibility here.

Hope it helps!