Jump to content


  • 0
giggsteve8

PowerShell detection methods and deployment status

Question

Hello everyone!

I wrote a simple PowerShell script to uninstall two different versions of a program A, and two different versions of program B. It's a basic "kill related processes, and then run msiexec /x". It works great, and it's packed into an application in SCCM 2012.

That being said, my results in the deployment status are confusing. Here is my detection method script:

if (!(Test-Path "C:\Program Files (x86)\Microsoft Office\Live Meeting 8"))

{

     write-host "Installed"

}

else

{

}

This path is "true" on every machine with the installed software. However, I deployed this application to 75 machines, and about 17 came back as successful, while 58 came back as "Successful: Already Compliant".

The removal script DID run; the software is gone and some of the directories I cleaned up in the script are also gone.

I just don't understand why it's coming back as "already compliant" when it clearly wasn't, and the application appears to have deployed successfully.

 

 

I'm obviously quite knew to SCCM, so please let me know if I can provide more information, or if I'm making a stupid mistake.

Thank you guys!!

Share this post


Link to post
Share on other sites

2 answers to this question

Recommended Posts

  • 0

Rather go for the product code of the msi in the installer database. Gambling with folders is not very clean, because of pending renames.

$ErrorActionPreference = "Stop"
if(!(gwmi -Namespace root\cimv2\sms -Class sms_installedsoftware -Filter "softwarecode = '{A8C8C39C-3CAB-4FB9-8A20-E70DABE84C91}' or softwarecode = '{A8C8C39C-3CAB-4FB9-8A20-E70DABE84C92}'")){return $true}



 

What you really should do, is defining your script as uninstall command in the deployment type of your application, instead as install command. This way you can use the product codes of your msi files as detection method, without scripted detection.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.