01 December 2013

Get the Software GUID

This script will get the proper software name and associated GUID. I use this script when writing uninstaller powershell scripts. You can use the GUID in an msiexec so that you do not need the source files for the uninstall.

You can download the script from here.

 #*******************************************************************************  
 #   Author: Mick Pletcher  
 #   Date: 30 November 2013  
 #  
 #   Program: Get Software Names and GUID  
 #*******************************************************************************  

 Clear-Host  

 Function RenameWindow ($Title) {  

      #Declare Local Memory  
      Set-Variable -Name a -Scope Local -Force  

      $a = (Get-Host).UI.RawUI  
      $a.WindowTitle = $Title  

      #Cleanup Local Memory  
      Remove-Variable -Name a -Scope Local -Force 
 
 }  

 Function GetProductName($Description) {
  
      #Declare Local Memory  
      Set-Variable -Name AppLocal -Scope Local -Force  
      Set-Variable -Name AppName -Scope Local -Force  
      Set-Variable -Name Desc -Scope Local -Force  
      Set-Variable -Name IDLocal -Scope Local -Force  
      Set-Variable -Name IDNumber -Scope Local -Force  
      Set-Variable -Name Uninstaller -Scope Local -Force
  
      #Change '%application%' to whatever app you are calling  
      $Description = [char]34+"description like"+[char]32+[char]39+[char]37+$Description+[char]37+[char]39+[char]34  
      $Desc = wmic product where $Description get Description  
      $Uninstaller = wmic product where $Description get IdentifyingNumber  
      $Desc | ForEach-Object {  
           $_ = $_.Trim()  
             if(($_ -ne "Description")-and($_ -ne "")){  
               $AppName += $_  
             }  
      }  
      $Uninstaller | ForEach-Object {  
           $_ = $_.Trim()  
             if(($_ -ne "IdentifyingNumber")-and($_ -ne "")){  
               $IDNumber += $_  
             }  
      }  
      $AppLocal = New-Object System.Object  
      $AppLocal | Add-Member -type NoteProperty -name Application -value $AppName  
      If ($AppName -ne $null) {  
           $AppLocal | Add-Member -type NoteProperty -name GUID -value $IDNumber  
      } else {  
           $AppLocal | Add-Member -type NoteProperty -name Status -value "Not Installed"  
      }  
      $AppLocal  

      #Cleanup Local Memory  
      Remove-Variable -Name AppLocal -Scope Local -Force  
      Remove-Variable -Name AppName -Scope Local -Force  
      Remove-Variable -Name Desc -Scope Local -Force  
      Remove-Variable -Name IDLocal -Scope Local -Force  
      Remove-Variable -Name IDNumber -Scope Local -Force  
      Remove-Variable -Name Uninstaller -Scope Local -Force 
 
 } 
 
 RenameWindow "Product Name and GUID"  
 GetProductName "Office Professional Plus"  
 GetProductName "Microsoft Lync 2013"  
 GetProductName "Adobe Reader"  
 GetProductName "Microsoft Visio Professional"  

Related Posts:

  • Enable or Disable Internet Explorer Active X Components This script will enable or disable Internet Explorer Active X components. All you have to do is pass the user friendly name of the component, component's GUID, and the flag. The app will verify if the change actually takes … Read More
  • Enable Wake-On-LAN NOTE: This is an old script. I have a newer and more efficient one located here. This script will enable WOL and test to make sure it has been set. It will return whether it was a success or failure both to a log file and … Read More
  • Get list of installed printers This function will get the list of printers installed for a user. It will also get the Default Printer. It outputs the list to Printers.txt, located at the location where the script is executed. You can download the script… Read More
  • Installing Dell CCTK and Configuring BIOS Settings This script will install the Dell CCTK and set specified BIOS settings. Unlike the CCTK that allows you to create a multiplatform file to run against any Dell model machine, this script takes a different approach so that t… Read More
  • Creating Active Setup Registry Key Here is a script I just wrote that will create an active setup registry key. It prompts you for the title, description, command line execution string, and version. It generates a unique GUID to name the registry key. It the… Read More

1 comments:

  1. This script will get the proper software name and associated GUID. I use this script when writing uninstaller powershell scripts. You can use the GUID in an msiexec so that you do not need the source files for the uninstall. http://commissionjailbreakfacts.com

    ReplyDelete