The usual way that people get around the various ProductCode values in this situation is to start with the more constant UpgradeCode.
Given the UpgradeCode, you can use MsiEnumRelatedProducts (or script or MSI interop equivalent) to return the ProductCode. Code like this typically never needs to be changed.
I'm pretty sure PowerShell should be able to do this.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…