12 December 2013

Verify SCCM can see Application GUIDs

I was deploying an application through SCCM and it continued to fail every time, although the app was completely installed. I knew it had to be with the verification process. I went through and entered all of the GUIDs for the apps being installed as the verification. I wrote the script below to verify WMI could see the GUIDs and come to find out, they were not registered in the HKCR, but the apps were registered in the HKLM, which makes it show up in the add/remove programs. This resolved my issue of the failure.

Create a text file named GUIDs.txt and enter a series of GUIDs. The script will read these GUIDs and then query WMI to see if they are registered. If they are not registered, nothing appears. If they are registered, all pertinent WMI data is displayed. At the end, it will list all of the GUIDs that WMI could not find. At this point, remove those GUIDs from the SCCM verification and the package should install with no issues.

You can download the script from here.

 #*******************************************************************************  
 #   Author: Mick Pletcher  
 #    Date: 12 December 2013  
 #  
 #   Program: Verify GUIDs  
 #*******************************************************************************  
   
 cls  
 Set-Variable -Name App -Value $null  
 Set-Variable -Name File -Force  
 Set-Variable -Name GUID -Force  
 Set-Variable -Name RelativePath -Scope Global -Force  
   
 $MissingGUIDs = @()  
 Function GetRelativePath {  
      $Global:RelativePath=(split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\"  
 }  
   
 GetRelativePath  
 $File = Import-Csv -Header GUID1 $Global:RelativePath"GUIDs.txt"  
 Foreach ($GUID in $File) {  
      #Write-Host $GUID.GUID1  
      #Get-WmiObject win32_product | Where-Object {$_.IdentifyingNumber -match "{5783F2D7-D004-0409-1102-0060B0CE6BBA}"}  
      $App = Get-WmiObject win32_product | Where-Object {$_.IdentifyingNumber -match $GUID.GUID1}  
      $App  
      If ($App.Name -like "") {  
           $MissingGUIDs += $GUID.GUID1  
      }  
      $App = $null  
 }  
 Write-Host  
 Write-Host "Missing GUIDs"  
 Write-Host "-------------"  
 $MissingGUIDs  
   
 #Cleanup Global Memory  
 Remove-Variable -Name App -Force  
 Remove-Variable -Name File -Force  
 Remove-Variable -Name GUID -Force  
 Remove-Variable -Name MissingGUIDs -Force  
 Remove-Variable -Name RelativePath -Scope Global -Force  
   

0 comments:

Post a Comment