Reputation: 11
I created and deleted the virtual directory using PowerShell, which works fine.
But how can I modify the name and port path ?
Upvotes: 1
Views: 7602
Reputation: 4289
I have a set of scripts for doing stuff like this which you may find useful. See https://github.com/alastairtree/deploy-websites-with-powershell
With that you can then do something like this:
CreateVirtualDirectory.ps1 [WebsiteName] [FolderName] [PhysicalPath] ([domain\user] [password])
I imagine adding port to that would be easy enough - feel free to fork it ;-)
Upvotes: 0
Reputation: 16823
This article covers the basics of using PowerShell to work with IIS bits
There is also a Web Administration (IIS) Provider covered here
Upvotes: 1
Reputation: 8663
Note this will only work on Windows 7 or Win2k8R2
Import-Module webadministration
That will import all the commands required to modify IIS websites , at this point you have 2 options , you can make the changes my navigating to IIS:\ and using set-Item etc or you can call
(Get-Website)
Which will list all your websites on the server , you can either index them manually to change the settings i.e (Get-Website)[0] will allow you to change the settings of the first site. Use (Get-Website) | Get-Member to get more details about the list of commands you can use.
Upvotes: 5