Rerun the failed Application deployment

Hi Team,

I am trying to write a code to Rerun those Applications in Software Center which are in “FAILED” status. Below the code I am using:

foreach ($comp in $computer)
                    {
                        $software = (Get-WmiObject -ClassName CCM_Program -ComputerName $comp -Namespace "root\ccm\clientSDK" | where LastRunStatus -EQ "Failed").name

                        foreach ($soft in $software)
                        {
                            cmd /c $soft.InstallString()   
                        }
                    }

I know, I am doing something wrong in installation part. Kindly Assist.

Thanks,

  cmd /c $soft.InstallString()   

This won’t work. What your doing here is saying to cmd “run the InstallString() method that is a member of the object represented by $soft”.

However, $soft is a string object and string objects don’t have an InstallString() method.

As far as I can tell from the documentation the CCM_Program class doesn’t have a method or property called InstallString either.

Thanks Matt. I knew that this is not going to work as I was getting the similar error as explained by you that such method does not exist.
Question here is what is the alternative? Any other way to reinstall?

Any help on this?

Sorry, been out this week and not had a chance to reply.

In your original post you say that the applications are showing as failed status in Software Centre. In SCCM these clients should also be showing that they failed to install. Is there any reason you are not re-running the deployment from SCCM rather than trying to re-run the software installation on the client?