-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add UNC Path support to WebVirtualDirectory (#634)
- WebVirtualDirectory - Added Credential paramater - Fixed error when using UNC PhysicalPath (issue #94).
- Loading branch information
1 parent
db3d024
commit 617e801
Showing
6 changed files
with
372 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
source/DSCResources/DSC_WebVirtualDirectory/en-US/DSC_WebVirtualDirectory.strings.psd1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
# culture ="en-US" | ||
ConvertFrom-StringData -StringData @' | ||
VerboseGetTargetResource = Get-TargetResource has been run. | ||
VerboseSetTargetPhysicalPath = Updating physical path for Web Virtual Directory '{0}'. | ||
VerboseSetTargetPhysicalPath = Updating PhysicalPath for Web Virtual Directory '{0}'. | ||
VerboseSetTargetCredential = Updating Credential for Web Virtual Directory '{0}'. | ||
VerboseSetTargetCreateVirtualDirectory = Creating new Web Virtual Directory '{0}'. | ||
VerboseSetTargetRemoveVirtualDirectory = Removing existing Virtual Directory '{0}'. | ||
VerboseTestTargetFalse = Physical path '{0}' for Web Virtual Directory '{1}' is not in desired state. | ||
VerboseTestTargetPhysicalPathFalse = Physical path '{0}' for Web Virtual Directory '{1}' is not in desired state. | ||
VerboseTestTargetCredentialFalse = Credential {0} for Web Virtual Directory '{1}' is not in desired state. | ||
VerboseTestTargetTrue = Web Virtual Directory is in desired state. | ||
VerboseTestTargetAbsentTrue = Web Virtual Directory '{0}' should be Absent and is Absent. | ||
'@ |
79 changes: 79 additions & 0 deletions
79
...ources/WebVirtualDirectory/Sample_WebVirtualDirectory_NewVirtualDirectory_WithUncPath.ps1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<# | ||
.SYNOPSIS | ||
Create a new web virtual directory on the Default Web Site | ||
.DESCRIPTION | ||
This example shows how to use the WebVirtualDirectory DSC resource to create a new virtual | ||
directory on the Default Web Site with a UNC path that requires credentials. | ||
#> | ||
configuration Sample_WebVirtualDirectory_NewVirtualDirectory_WithUncPath | ||
{ | ||
param | ||
( | ||
# Target nodes to apply the configuration | ||
[System.String[]] | ||
$NodeName = 'localhost', | ||
|
||
# Name of virtual directory to create | ||
[Parameter(Mandatory)] | ||
[ValidateNotNullOrEmpty()] | ||
[System.String] | ||
$VirtualDirectoryName, | ||
|
||
# Physical path of the virtual directory | ||
[Parameter(Mandatory)] | ||
[ValidateNotNullOrEmpty()] | ||
[System.String] | ||
$PhysicalPath, | ||
|
||
# Credential to use for the virtual directory | ||
[Parameter(Mandatory)] | ||
[ValidateNotNullOrEmpty()] | ||
[PSCredential] | ||
$Credential | ||
) | ||
|
||
# Import the module that defines custom resources | ||
Import-DscResource -Module PSDesiredStateConfiguration | ||
Import-DscResource -Module WebAdministrationDsc | ||
|
||
Node $NodeName | ||
{ | ||
# Install the IIS role | ||
WindowsFeature IIS | ||
{ | ||
Ensure = 'Present' | ||
Name = 'Web-Server' | ||
} | ||
|
||
# Start the default website | ||
WebSite DefaultSite | ||
{ | ||
Ensure = 'Present' | ||
Name = 'Default Web Site' | ||
State = 'Started' | ||
PhysicalPath = 'C:\inetpub\wwwroot' | ||
DependsOn = '[WindowsFeature]IIS' | ||
} | ||
|
||
# Copy the virtual directory content | ||
File VirtualDirectoryContent | ||
{ | ||
Ensure = 'Present' | ||
DestinationPath = $PhysicalPath | ||
Type = 'Directory' | ||
DependsOn = '[WindowsFeature]IIS' | ||
} | ||
|
||
# Create the new virtual directory | ||
WebVirtualDirectory NewVirtualDirectory | ||
{ | ||
Ensure = 'Present' | ||
Website = "Default Web Site" | ||
WebApplication = '' | ||
Name = $VirtualDirectoryName | ||
PhysicalPath = $PhysicalPath | ||
DependsOn = '[File]VirtualDirectoryContent' | ||
Credential = $Credential | ||
} | ||
} | ||
} |
Oops, something went wrong.