"\" -Join path parts

This commit is contained in:
onyx-and-iris 2023-08-17 15:02:03 +01:00
parent 108731b4cf
commit d305a4048d

View File

@ -1,11 +1,17 @@
function Get_VMPath { function Get_VMPath {
$REG_KEY = "Registry::HKEY_LOCAL_MACHINE\Software" + ` $REG_KEY = @(
(& { if ([Environment]::Is64BitOperatingSystem) { "\WOW6432Node" } else { "" } }) + ` "Registry::HKEY_LOCAL_MACHINE",
"\Microsoft\Windows\CurrentVersion\Uninstall" "Software",
$VM_KEY = "\VB:Voicemeeter {17359A74-1236-5467}\" (& { if ([Environment]::Is64BitOperatingSystem) { "WOW6432Node" } else { "" } }),
"Microsoft",
"Windows",
"CurrentVersion",
"Uninstall"
).Where({ $_ -ne "" }) -Join "\"
$VM_KEY = "VB:Voicemeeter {17359A74-1236-5467}"
try { try {
return $(Get-ItemPropertyValue -Path ($REG_KEY + $VM_KEY) -Name UninstallString | Split-Path -Parent) return $(Get-ItemPropertyValue -Path (@($REG_KEY, $VM_KEY) -Join "\") -Name UninstallString | Split-Path -Parent)
} }
catch { catch {
throw [VMRemoteError]::new("Unable to fetch Voicemeeter path from the Registry.") throw [VMRemoteError]::new("Unable to fetch Voicemeeter path from the Registry.")