Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 729
  • Last Modified:

PowerShell command

Hi,
I'm trying to execute below PS command, posted on http://blogs.citrix.com/2014/03/27/hiding-applications-in-citrix-storefront/#comment-134229

$dsInstallProp = Get-ItemProperty `
 -Path HKLM:\SOFTWARE\Citrix\DeliveryServicesManagement -Name InstallDir
$dsInstallDir = $dsInstallProp.InstallDir
& $dsInstallDir\..\Scripts\ImportModules.ps1

I'm getting all sorts of errors such as
1. Ampersand not allowed
2. Get-ItemProperty : A positional parameter cannot be found that accepts argument 'C:\Program Files\Citrix\Receiver Store
Front\Management\'.
At line:1 char:34
+ $dsInstallProp = Get-ItemProperty <<<<  -Path HKLM:\SOFTWARE\Citrix\DeliveryServicesManagement -Name InstallDir $dsIn
stallDir = "$dsInstallProp.InstallDir & $dsInstallDir\..\Scripts\ImportModules.ps1"
    + CategoryInfo          : InvalidArgument: (:) [Get-ItemProperty], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand

Please advise
I need to get PS working
0
johnkim777
Asked:
johnkim777
  • 2
  • 2
1 Solution
 
Justin YeungCommented:
what would you like to do?
change the value to something?
0
 
QlemoC++ DeveloperCommented:
Obviously your carriage returns are not correct, and the commands are joined together into a single line. Make sure you use an editor like Notepad using correct line breaks for the ps1 file.
0
 
Justin YeungCommented:
+ $dsInstallProp = Get-ItemProperty <<<<  -Path

indiated the error here..........

TAKE ` AWAY AND MOVE IT TO THE SAME LINE...... OR PLACE ` BACK AFTER IT FOR CONTINUE NEXT LINE

$dsInstallProp = Get-ItemProperty -Path HKLM:\SOFTWARE\Citrix\DeliveryServicesManagement -Name InstallDir
0
 
QlemoC++ DeveloperCommented:
I don't know what you are trying to tell us, but try this:
$dsInstallProp = Get-ItemProperty -Path HKLM:\SOFTWARE\Citrix\DeliveryServicesManagement -Name InstallDir 
$dsInstallDir = $dsInstallProp.InstallDir 
& "$dsInstallDir\..\Scripts\ImportModules.ps1" 

Open in new window

0
 
johnkim777Author Commented:
THANK YOU
It worked!!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now