I'm installing the DXA 1.7 Audience Manager module to a .NET web application on my local laptop (Windows 10) as per below doc link. Install of module to Web 8.5 Content Manager was successful. https://docs.sdl.com/LiveContent/content/en-US/SDL%20DXA-v7/GUID-4DECD33D-C723-4C37-8B83-7FADFEED1024

From the modules\AudienceManager\web folder, I have a PowerShell window open and am running script with below output

'.\web-install.ps1' -distDestination 
At line:1 char:21
+ '.\web-install.ps1' -distDestination "C:\Users\tkim\source\repos\DXAW ...
+                     ~~~~~~~~~~~~~~~~
Unexpected token '-distDestination' in expression or statement.
At line:1 char:38
+ ... all.ps1' -distDestination "C:\Users\tkim\source\repos\DXAWebapp\Site"
+                               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Unexpected token '"C:\Users\tkim\source\repos\DXAWebapp\Site"' in expression or statement.
+ CategoryInfo          : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : UnexpectedToken

I've tried several variations of the PS script including no apostrophes before and after web-install.ps1, single quotes for the distDestination path, etc. Any suggestions as to what I am doing incorrectly?

1 Answer 1


It seems you problem is in understanding how to use PowerShell exactly, and the documentation isn't overly clear on that I agree, since it uses the single quotes (they are single quotes rather than apostrophes I learned here https://english.stackexchange.com/questions/36046/apostrophe-vs-single-quote ;o) in an example where they don't need to be used.

In a PowerShell Command Prompt you can execute a script by starting the line with a . (which indicates the current directory). Then you proceed with the path to the script, and since you are in the directory of the script, you write .\script-name.ps1. Now if you want to execute a script in a different location, you can supply the full path of the script, i.e. .\directory\script-name.ps1. When the path to the script contains any spaces, then you have to use single quotes around the path, since PowerShell thinks the space would be a separator in the command. Then to indicate you are executing a script you have to add an & (ampersand) character in front of your line in the Command Prompt (that is the call operator). So it would then look like this:

& '.\path with spaces\script-name.ps1'

As for the distDestination parameter, also there you can use single or double quotes if your value contains a space. For example the following are all correct:

& '.\path with spaces\script-name.ps1' -parameter 'c:\program files\'

& ".\path with spaces\script-name.ps1" -parameter "c:\program files\"

& '.\path with spaces\script-name.ps1' -parameter "c:\program files\"

& ".\path with spaces\script-name.ps1" -parameter 'c:\program files\'

So that concludes that in your case you can use any of the following to execute your script in a PowerShell Command Prompt

.\web-install.ps1 -distDestination C:\Users\tkim\source\repos\DXAWebapp\Site

& '.\web-install.ps1' -distDestination 'C:\Users\tkim\source\repos\DXAWebapp\Site'

& ".\web-install.ps1" -distDestination "C:\Users\tkim\source\repos\DXAWebapp\Site"

& '.\web-install.ps1' -distDestination "C:\Users\tkim\source\repos\DXAWebapp\Site"

& ".\web-install.ps1" -distDestination 'C:\Users\tkim\source\repos\DXAWebapp\Site'

And probably a few more with and without quotes, just make sure than when you are using quotes around the script, you start with an ampersand (&). It actually never hurts to start with an ampersand (&) in PowerShell when you are wanting to execute a script, see https://ss64.com/ps/call.html

  • Confirming several of the examples given worked, appreciate the detailed response.
    – Terry Kim
    Jan 29, 2018 at 14:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.