Solved

PowerShell command

Posted on 2014-03-28
5
688 Views
Last Modified: 2014-03-28
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
Comment
Question by:johnkim777
  • 2
  • 2
5 Comments
 
LVL 14

Expert Comment

by:Justin Yeung
ID: 39961504
what would you like to do?
change the value to something?
0
 
LVL 68

Expert Comment

by:Qlemo
ID: 39961869
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
 
LVL 14

Expert Comment

by:Justin Yeung
ID: 39961893
+ $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
 
LVL 68

Accepted Solution

by:
Qlemo earned 500 total points
ID: 39962391
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
 

Author Closing Comment

by:johnkim777
ID: 39962852
THANK YOU
It worked!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The article will show you how you can maintain a simple logfile of all Startup and Shutdown events on Windows servers and desktops with PowerShell. The script can be easily adapted into doing more like gracefully silencing/updating your monitoring s…
"Migrate" an SMTP relay receive connector to a new server using info from an old server.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now