I know exactly how to search the registry for a key with a DisplayName equal to the name of the programs, say “Symantec Endpoint Protection”. But the problem is, I don’t know whether or not the computer this will be running on is 32 bit or 64 bit. Therefore, I need to write it based on 32-bit.
My code works fine if the powershell instance is 64-bit, but it doesn’t work at all if it’s 32 bit and I can’t understand why. I know it’s not because I’m including $key2 in the search path. Are the functions I’m using 64-bit only? If so, do I have an alternative (that’s not WMI)?
I’m not getting any errors except at the last line where it says it cannot index into a null array, which indicates that it did not find any registry entries matching my search terms.
[/quote]
I understand, I just assumed it wasn't a big deal and that it would simply skip the 64-bit part if it was a 32-bit system. I ended up just using the 32-bit path, since this application should always be found in both locations on a 64-bit machine.