How to: Set Up Multiple Web Server Instances for the Microsoft Dynamics NAV Web Client – Part 2

If you enjoyed (or still enjoying?) creating your Web Clients manually like I described in one of my previous posts How to: Set Up Multiple Web Server Instances for the Microsoft Dynamics NAV Web Client – Part 1, so I believe it is time to automate this process a little bit.

In order to achieve that, I wrote a small PowerShell script. I believe the script is self explanatory 😉

Feel free to use it, or better enhance it 🙂

 

#Set-ExecutionPolicy RemoteSigned

mkdir 'C:\Inetpub\wwwroot\MyWebClient'
mkdir 'C:\ProgramData\Microsoft\Microsoft Dynamics NAV\90\Web Client\MyWebClient\WebClient\Resources\ExtractedResources'
cmd /c icacls 'C:\ProgramData\Microsoft\Microsoft Dynamics NAV\90\Web Client\MyWebClient\WebClient\Resources\ExtractedResources' /grant 'IIS_IUSRS:(OI)(CI)(RX,W)'
copy 'C:\Inetpub\wwwroot\\DynamicsNAV90\web.config' 'C:\Inetpub\wwwroot\MyWebClient\web.config'
Invoke-Expression -Command 'cmd /c mklink /d "C:\Inetpub\wwwroot\MyWebClient\WebClient" "C:\Program Files\Microsoft Dynamics NAV\90\Web Client"'

Import-Module WebAdministration
IIS:
New-WebVirtualDirectory -Site 'Microsoft Dynamics NAV 2016 Web Client' -Name 'MyWebClient' -PhysicalPath 'C:\Inetpub\wwwroot\MyWebClient'
ConvertTo-WebApplication -PSPath 'IIS:\Sites\Microsoft Dynamics NAV 2016 Web Client\MyWebClient\WebClient' -ApplicationPool 'Microsoft Dynamics NAV 2016 Web Client Application Pool'
New-Item 'IIS:\Sites\Microsoft Dynamics NAV 2016 Web Client\MyWebClient\WebClient\Resources\ExtractedResources' -type VirtualDirectory -physicalPath 'C:\ProgramData\Microsoft\Microsoft Dynamics NAV\90\Web Client\MyWebClient\WebClient\Resources\ExtractedResources'

 

This blog is available also on Microsoft Dynamics NAV Community

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s