Reputation: 2625
I'm using IIS6
using powershell I would like to export a specific virtual directory to a file, change the name and some paths and then reimport the data, creating a new virtual directory
It looks like IISComputer.Export would do the job but try as I might I can't get it to work
Upvotes: 4
Views: 462
Reputation: 2625
This is the solution I found
From the link here MSDN DirectoryEntry.CopyTo I worked out that I would be able to copy the virtual directory then set the properties manually
From there I came up with the following powershell code which lets my clone a virtual directory then re point it
$vd = [ADSI]"IIS://localhost/W3SVC/1/Root/CurrentVd"
$parent = [ADSI]"IIS://localhost/W3SVC/1/Root"
$vd.CopyTo($parent,"NewVd")
Set Application Pool
$vd.AppPoolId = "MyNewAppPool"
Set Virtual Directory
$Vd.Path = "C:\MyNewTargetPath"
$parent.CommitChanges()
Upvotes: 1