Diana Ruse
Diana Ruse

Reputation: 21

How do I change the physical path of web site in IIS10 with APPCMD to Amazon FSx path?

I need to change the physical path of a web site through command line via the appcmd.exe tool which I want to point to Amazon FSx, but I can't figure out why I have errors. Here is what I'm using in PowerShell as admin:

PS C:\Windows\system32> appcmd list app

APP "Test Services/" (applicationPool:Test Services)

APP "Test Simple Site/" (applicationPool:Test Simple Site)

APP "Test/" (applicationPool:Test)

PS C:\Windows\system32> appcmd list vdir

VDIR "Test Services/" (physicalPath:\amznfsxthjfzxec.test.local\share\Sites\TestServices)

VDIR "Test Simple Site/" (physicalPath:\amznfsxthjfzxec.test.local\share\Sites\TestSimple)

VDIR "Test/" (physicalPath:C:\inetpub\wwwroot)

PS C:\Windows\system32> appcmd set site /site.name:"Test" /application[path='Test/'].virtualDirectory[path='Test/'].physicalPath:"\\amznfsxthjfzxec.test.local\share\Sites\Test"

ERROR ( message:Malformed collection indexer; format is [@position,name='value',name2='value2',...]. The @position specifier is optional, and be '@start', '@end', or '@N' where N is a numeric index into the collection. )

Could you please advise me? Thank you!

Upvotes: 0

Views: 680

Answers (1)

Jokies Ding
Jokies Ding

Reputation: 3494

If you want to replace physical path for the virtual directory under site level.

Please try this

appcmd.exe set config  -section:system.applicationHost/sites /[name='Default Web Site'].[path='/'].[path='/myvir'].physicalPath:"\\WIN10\Share"  /commit:apphost

If you also have an application under my site like "mysite/myapplication" and the virtual dirtory is "mysite/myapplication/my virtual.

Then you could try this

appcmd.exe set config  -section:system.applicationHost/sites /[name='Mysite'].[path='/myapp'].[path='/myvir'].path:"\\WIN10"  /commit:apphost

Please remember to run cmd as adminsitrator when you try this.

Upvotes: 0

Related Questions