Reputation: 154
I am writing a test case script which installs Citrix Receiver, checks whether the store has been created and then uninstalls it.
The way I am uninstalling Receiver is by running this command:
Start-Process "C:\ProgramData\Citrix\Citrix Receiver 4.12\TrolleyExpress.exe" -argumentlist "/silent /uninstall /cleanup" -Wait -PassThru
The path to TrolleyExpress.exe
and /uninstall /cleanup
arguments are obtained from a registry key value.
I have obtained the value contents and contained it into a variable:
$uninstallString = (Get-ItemProperty -path HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\CitrixOnlinePluginPackWeb -name UninstallString).UninstallString
$uninstallString
becomes C:\ProgramData\Citrix\Citrix Receiver 4.12\TrolleyExpress.exe /uninstall /cleanup
What I'm aiming for is to get the path to TrolleyExpress.exe
from the regedit directly, since it is a test case which will run on multiple machines. In case the Receiver is installed on something different than C:
or different path.
This is my first month into PowerShell Scripting and I'm quite new to Regular Expressions.
Any help\suggestion on how this could be solved is highly appreciated!
Upvotes: 1
Views: 259
Reputation: 8432
Assuming the path in the registry follows the example you give (except possibly the drive letter), then one easy way to get just the path is:
$exePath = $uninstallString.Split('/')[0]
Upvotes: 2