Windows Vista Forums
Vista Forums Home Join Vista Forums Webcasts Windows 7 Forum Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > PowerShell

PowerShell 1.0 & IIS6 & Virtual directory

Update your Vista Drivers Update Your Drivers Now!!
Closed Thread
 
Thread Tools Display Modes
Old 05-21-2008   #1 (permalink)
philippe
Guest


 

PowerShell 1.0 & IIS6 & Virtual directory

Hi,

Does someone has some code sample on how to create a virtual directory in
IIS 6 with PowerShell ?
Also how can I test if a virtual directory already exists ?

Thanks

My System SpecsSystem Spec
Old 05-21-2008   #2 (permalink)
Shay Levi
Guest


 

Re: PowerShell 1.0 & IIS6 & Virtual directory



Hi Philippe,

This creates a new virtual directory on the local iis with tha name of 'NewVDir'.
To create the directory on a remote computer, Replace 'localhost' with a
remote iis computer name.


$iis=[adsi]"IIS://localhost/W3SVC/1/Root"
$vd = $iis.psbase.children.Add("NewVDir","IISWebVirtualDir")
$vd.put("Path","D:\AdminDB")
$vd.psbase.CommitChanges()


To check if a virtual directory already exists:

$vdir = $iis.psbase.children | where {$_.AppRoot -eq '/LM/W3SVC/1/Root/NewVDir'}
if($vdir) { 'already exists' }



---
Shay Levi
$cript Fanatic
http://scriptolog.blogspot.com
Quote:

> Hi,
>
> Does someone has some code sample on how to create a virtual directory
> in
> IIS 6 with PowerShell ?
> Also how can I test if a virtual directory already exists ?
> Thanks
>

My System SpecsSystem Spec
Closed Thread

Thread Tools
Display Modes



Similar Threads
Thread Thread Starter Forum Replies Last Post
Directory Size using PowerShell dm3281 PowerShell 8 08-01-2008 08:19 AM
How do I delete an OU in Active Directory from Powershell. Johannes L PowerShell 3 05-19-2008 10:02 PM
Programs are suddenly unable to acces their (virtual) installation directory Chillin' General Discussion 0 04-15-2008 07:09 PM
Powershell & Active Directory orphan PowerShell 3 05-03-2007 04:33 AM
Active Directory support in PowerShell bill PowerShell 1 01-11-2007 01:57 PM


Vistax64.com is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media 2005-2008

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51