powershell determine os architecture

On x64 system [Environment]::Is64BitOperatingSystem gives $true. Therefore, you could do this:

if ([Environment]::Is64BitOperatingSystem) 
{
    Write-Host "x64 operating system" 
    $Version = Get-ChildItem hklm:\software\wow6432node\microsoft\windows\currentversion\uninstall | ForEach-Object {Get-ItemProperty $_.pspath} | Where-Object {
    $_.DisplayName -Eq 'Microsoft Lync 2013'} | Select-Object DisplayVersion
} 
else 
{
    Write-Host "x86 operating system"
    $Version = Get-ChildItem hklm:\software\microsoft\windows\currentversion\uninstall | ForEach-Object {Get-ItemProperty $_.pspath} | Where-Object {
    $_.DisplayName -Eq 'Microsoft Lync 2013'} | Select-Object DisplayVersion 
}