If you want to use the systems “%PROGRAMFILES%” folder in PowerShell, use:
$rootInstallationFolder = [System.Environment]::GetFolderPath([System.Environment+SpecialFolder]::ProgramFiles)
C:\Program Files (x86)
Because SpecialFolders is a nested type in System.Environment, you must use the “+” sign and not a “.”, else you get the error:
Unable to find type [System.Environment.SpecialFolder]: make sure that the assembly containing this type is loaded.