xWebAdmin Unexpected token 'present" name ="Default' in expression or statement

This topic contains 3 replies, has 3 voices, and was last updated by Profile photo of Don Jones Don Jones 7 months, 1 week ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #35527
    Profile photo of Nick Kou
    Nick Kou

    Hi guys,
    I'm trying to publish a dsc config in Azure. I have a vm in Azure, and installed PowerShell 5

    PS C:\Windows\system32> $PSVersionTable
    Name                           Value                                                                                                                                 
    ----                           -----                                                                                                                                 
    PSVersion                      5.0.10514.6                                                                                                                           
    WSManStackVersion              3.0                                                                                                                                   
    CLRVersion                     4.0.30319.42000                                                                                                                       
    BuildVersion                   10.0.10514.6                                                                                                                          
    PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                               
    PSRemotingProtocolVersion      2.3                      

    and xWebAdministration

    PS C:\Windows\system32> Get-DscResource
    PowerShell      xIisFeatureDelegation     xWebAdministration       {OverrideMode, SectionName, DependsOn, PsDscRun...
    PowerShell      xIisHandler               xWebAdministration       {Ensure, Name, DependsOn, PsDscRunAsCredential}   
    PowerShell      xIisMimeTypeMapping       xWebAdministration       {Ensure, Extension, MimeType, DependsOn...}       
    PowerShell      xIisModule                xWebAdministration       {Name, Path, RequestPath, Verb...}                
    PowerShell      xSSLSettings              xWebAdministration       {Bindings, Name, DependsOn, Ensure...}            
    PowerShell      xWebApplication           xWebAdministration       {Name, PhysicalPath, WebAppPool, Website...}      
    PowerShell      xWebAppPool               xWebAdministration       {Name, autoShutdownExe, autoShutdownParams, aut...
    PowerShell      xWebAppPoolDefaults       xWebAdministration       {ApplyTo, DependsOn, IdentityType, ManagedRunti...
    PowerShell      xWebConfigKeyValue        xWebAdministration       {ConfigSection, Key, WebsitePath, DependsOn...}   
    PowerShell      xWebsite                  xWebAdministration       {Name, PhysicalPath, ApplicationPool, BindingIn...
    PowerShell      xWebSiteDefaults          xWebAdministration       {ApplyTo, AllowSubDirConfig, DefaultApplication...
    PowerShell      xWebVirtualDirectory      xWebAdministration       {Name, PhysicalPath, WebApplication, Website...}  

    However, when I complie the below configuration, it came across the error. it has the red squiggly at xWebsite DefaultSite section > Ensure = "Present".
    And the error is:
    Unexpected token 'present"
    Name = "Default' in expression or statement.
    There is an incomplete property assignment block in the instance definition.

    The dsc config:

    Configuration FourthCoffee
        Import-DscResource -Module @{ModuleName = 'xWebAdministration';ModuleVersion=''}
        # Install the IIS role
        WindowsFeature IIS 
            Ensure          = “Present” 
            Name            = “Web-Server” 
        # Install the ASP .NET 4.5 role
        WindowsFeature AspNet45 
            Ensure          = “Present” 
            Name            = “Web-Asp-Net45″ 
        # Stop the default website
        xWebsite DefaultSite 
            Ensure          = “Present” 
            Name            = “Default Web Site” 
            State           = “Stopped” 
            PhysicalPath    = “C:\inetpub\wwwroot” 
            DependsOn       = “[WindowsFeature]IIS” 
        # Copy the website content
        File WebContent 
            Ensure          = “Present” 
            SourcePath      = “C:\Program Files\WindowsPowerShell\Modules\xWebAdministration\BakeryWebsite”
            DestinationPath = “C:\inetpub\FourthCoffee”
            Recurse         = $true 
            Type            = “Directory” 
            DependsOn       = “[WindowsFeature]AspNet45″ 
        # Create a new website
        xWebsite BakeryWebSite 
            Ensure          = “Present” 
            Name            = “FourthCoffee”
            State           = “Started” 
            PhysicalPath    = “C:\inetpub\FourthCoffee” 
            DependsOn       = “[File]WebContent” 

    Any help will be apperciated.


    Profile photo of Dave Wyatt
    Dave Wyatt

    Seems to be those weird smart quotes that are around many of your strings, particularly the one that's closing "Web-Asp-Net45" and "[WindowsFeature]AspNet45". When I replaced those with a plain double-quotation mark, the rest seemed to parse okay.

    Profile photo of Nick Kou
    Nick Kou

    Thanks Dave. That is so embarrass... I tried to fix this for a few hours.
    I copy the conf from technet, it that case scenario I always think there is something wrong with my setup. anyway, thanks for your support.

    Profile photo of Don Jones
    Don Jones

    Notably, if you copy and paste from a website, you'll often end up with non-straight quotes. It's bitten me more than once.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.