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
    Posts
  • #35527
    Profile photo of Nick Kou
    Nick Kou
    Participant

    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                                                                                                                                   
    SerializationVersion           1.1.0.1                                                                                                                               
    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             1.9.0.0    {OverrideMode, SectionName, DependsOn, PsDscRun...
    PowerShell      xIisHandler               xWebAdministration             1.9.0.0    {Ensure, Name, DependsOn, PsDscRunAsCredential}   
    PowerShell      xIisMimeTypeMapping       xWebAdministration             1.9.0.0    {Ensure, Extension, MimeType, DependsOn...}       
    PowerShell      xIisModule                xWebAdministration             1.9.0.0    {Name, Path, RequestPath, Verb...}                
    PowerShell      xSSLSettings              xWebAdministration             1.9.0.0    {Bindings, Name, DependsOn, Ensure...}            
    PowerShell      xWebApplication           xWebAdministration             1.9.0.0    {Name, PhysicalPath, WebAppPool, Website...}      
    PowerShell      xWebAppPool               xWebAdministration             1.9.0.0    {Name, autoShutdownExe, autoShutdownParams, aut...
    PowerShell      xWebAppPoolDefaults       xWebAdministration             1.9.0.0    {ApplyTo, DependsOn, IdentityType, ManagedRunti...
    PowerShell      xWebConfigKeyValue        xWebAdministration             1.9.0.0    {ConfigSection, Key, WebsitePath, DependsOn...}   
    PowerShell      xWebsite                  xWebAdministration             1.9.0.0    {Name, PhysicalPath, ApplicationPool, BindingIn...
    PowerShell      xWebSiteDefaults          xWebAdministration             1.9.0.0    {ApplyTo, AllowSubDirConfig, DefaultApplication...
    PowerShell      xWebVirtualDirectory      xWebAdministration             1.9.0.0    {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='1.3.2.4'}
    
        # 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.

    Thanks,
    Nick

    #35528
    Profile photo of Dave Wyatt
    Dave Wyatt
    Moderator

    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.

    #35531
    Profile photo of Nick Kou
    Nick Kou
    Participant

    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.

    #35532
    Profile photo of Don Jones
    Don Jones
    Keymaster

    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.