I am running a script that queries windows and its registry. I'm trying to add a code where it can query both 64bit and 32bit versions of the OS.
So if it's a 32bit then it should look at HKLM_SOFTWARE_TEAMVIEWER and if it's 64bit it should query at HKLM_SOFTWARE_WOW6432Node_Teamviewer
So, how should this part look to query both locations depending on OS type?
$TVID = (Get-ItemProperty "HKLM:\SOFTWARE\TeamViewer").ClientID
This is the script:
Param(
[string]$ServerShare
)
$dom = $env:userdomain
$usr = $env:username
$Fullname = ([adsi]"WinNT://$dom/$usr,user").fullname
$TVID = (Get-ItemProperty "HKLM:\SOFTWARE\TeamViewer").ClientID
if (!$TVID) { $TVID = (Get-ItemProperty "HKLM:\SOFTWARE\TeamViewer\Version9").ClientID }