Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xWebVirtualDirectory: Must specify '/' for WebApplication when virtual directory is under the website #366

Closed
Davidsod opened this issue Jun 10, 2018 · 12 comments · Fixed by #618
Labels
documentation The issue is related to documentation only.

Comments

@Davidsod
Copy link

Hello,

When running the resource with 'Absent' flag, I'm getting the following error:
##[error]PowerShell Desired State Configuration does not support execution of commands in an interactive mode. Please ensure that the underlying command is not prompting for user input, such as missing mandatory parameter, confirmation prompt etc. + CategoryInfo : NotSpecified: (:) [], CimException + FullyQualifiedErrorId : System.NotSupportedException,Microsoft.IIs.PowerShell.Provider.RemoveVirtualDirectoryCom mand + PSComputerName : IPAddress

'Ensure' works perfectly but when I run it with 'Absent' it brings up the above error.

Appreciate your assistance,
David

@johlju
Copy link
Member

johlju commented Jun 11, 2018

Could you please provide the verbose output and your configuration? Both with the sensitive information obfuscated.

@johlju johlju added the needs more information The issue needs more information from the author or the community. label Jun 11, 2018
@Davidsod
Copy link
Author

Davidsod commented Jun 11, 2018

Hello johlju,

Thank you for your quick response.

Note that the problematic is Vd1.

Verbose output of the xWebVirtualDirectory section

2018-06-10T14:47:45.0167701Z VERBOSE: [ServerName]: LCM:  [ Start  Resource ]  [[xWebVirtualDirectory]Vd1]
2018-06-10T14:47:45.0167701Z VERBOSE: [ServerName]: LCM:  [ Start  Test     ]  [[xWebVirtualDirectory]Vd1]
2018-06-10T14:47:45.0636518Z VERBOSE: [ServerName]: LCM:  [ End    Test     ]  [[xWebVirtualDirectory]Vd1]  in 0.0780 seconds.
2018-06-10T14:47:45.0636518Z VERBOSE: [ServerName]: LCM:  [ Start  Set      ]  [[xWebVirtualDirectory]Vd1]
2018-06-10T14:47:45.1104968Z VERBOSE: [ServerName]:                            [[xWebVirtualDirectory]Vd1] Removing existing Virtual Directory "Vd1".
2018-06-10T14:47:45.4386355Z ##[error]PowerShell Desired State Configuration does not support execution of commands in an interactive mode. Please ensure 
that the underlying command is not prompting for user input, such as missing mandatory parameter, confirmation prompt 
etc.
    + CategoryInfo          : NotSpecified: (:) [], CimException
    + FullyQualifiedErrorId : System.NotSupportedException,Microsoft.IIs.PowerShell.Provider.RemoveVirtualDirectoryCom 
   mand
    + PSComputerName        : x.x.x.x
 

2018-06-10T14:47:45.4542634Z VERBOSE: [ServerName]: LCM:  [ End    Set      ]  [[xWebVirtualDirectory]Vd1]  in 0.1870 seconds.
2018-06-10T14:47:45.4698911Z ##[error]The PowerShell DSC resource '[xWebVirtualDirectory]i' with SourceInfo 
'D:\PathToScript\WebSite.ps1::804::13::xWebVirtualDirectory' threw one or more 
non-terminating errors while running the Set-TargetResource functionality. These errors are logged to the ETW channel 
called Microsoft-Windows-DSC/Operational. Refer to this channel for more details.
    + CategoryInfo          : InvalidOperation: (:) [], CimException
    + FullyQualifiedErrorId : NonTerminatingErrorFromProvider
    + PSComputerName        : x.x.x.x
 

2018-06-10T14:47:45.4698911Z VERBOSE: [ServerName]: LCM:  [ Start  Resource ]  [[xWebVirtualDirectory]Vd2]
2018-06-10T14:47:45.4698911Z VERBOSE: [ServerName]: LCM:  [ Start  Test     ]  [[xWebVirtualDirectory]Vd2]
2018-06-10T14:47:45.4698911Z VERBOSE: [ServerName]:                            [[xWebVirtualDirectory]Vd2] Physical path 
2018-06-10T14:47:45.4698911Z "\\ServerName\PathToVd2" for web virtual directory "Vd2" does not match desired
2018-06-10T14:47:45.4698911Z  state.
2018-06-10T14:47:45.4698911Z VERBOSE: [ServerName]: LCM:  [ End    Test     ]  [[xWebVirtualDirectory]Vd2]  in 0.0470 seconds.
2018-06-10T14:47:45.4698911Z VERBOSE: [ServerName]: LCM:  [ Start  Set      ]  [[xWebVirtualDirectory]Vd2]
2018-06-10T14:47:45.4698911Z VERBOSE: [ServerName]:                            [[xWebVirtualDirectory]Vd2] Updating physical path for web virtual 
2018-06-10T14:47:45.4698911Z directory "Vd2".
2018-06-10T14:47:45.4698911Z VERBOSE: [ServerName]: LCM:  [ End    Set      ]  [[xWebVirtualDirectory]Vd2]  in 0.1090 seconds.
2018-06-10T14:47:45.4698911Z VERBOSE: [ServerName]: LCM:  [ End    Resource ]  [[xWebVirtualDirectory]Vd2]
2018-06-10T14:47:45.4855009Z VERBOSE: [ServerName]: LCM:  [ Start  Resource ]  [[xWebVirtualDirectory]Vd3]
2018-06-10T14:47:45.4855009Z VERBOSE: [ServerName]: LCM:  [ Start  Test     ]  [[xWebVirtualDirectory]Vd3]
2018-06-10T14:47:45.5480256Z VERBOSE: [ServerName]:                            [[xWebVirtualDirectory]Vd3] Web virtual directory is in required 
2018-06-10T14:47:45.5480256Z state.
2018-06-10T14:47:45.5480256Z VERBOSE: [ServerName]: LCM:  [ End    Test     ]  [[xWebVirtualDirectory]Vd3]  in 0.0630 seconds.
2018-06-10T14:47:45.5480256Z VERBOSE: [ServerName]: LCM:  [ Skip   Set      ]  [[xWebVirtualDirectory]Vd3]
2018-06-10T14:47:45.5480256Z VERBOSE: [ServerName]: LCM:  [ End    Resource ]  [[xWebVirtualDirectory]Vd3]
2018-06-10T14:47:45.5636398Z VERBOSE: [ServerName]: LCM:  [ Start  Resource ]  [[xWebVirtualDirectory]vd4]
2018-06-10T14:47:45.5636398Z VERBOSE: [ServerName]: LCM:  [ Start  Test     ]  [[xWebVirtualDirectory]vd4]
2018-06-10T14:47:45.5949062Z VERBOSE: [ServerName]:                            [[xWebVirtualDirectory]vd4] Web virtual directory is in required 
2018-06-10T14:47:45.5949062Z state.
2018-06-10T14:47:45.5949062Z VERBOSE: [ServerName]: LCM:  [ End    Test     ]  [[xWebVirtualDirectory]vd4]  in 0.0620 seconds.
2018-06-10T14:47:45.5949062Z VERBOSE: [ServerName]: LCM:  [ Skip   Set      ]  [[xWebVirtualDirectory]vd4]
2018-06-10T14:47:45.5949062Z VERBOSE: [ServerName]: LCM:  [ End    Resource ]  [[xWebVirtualDirectory]vd4]
2018-06-10T14:47:45.6105215Z VERBOSE: [ServerName]: LCM:  [ Start  Resource ]  [[xWebVirtualDirectory]vd5]
2018-06-10T14:47:45.6105215Z VERBOSE: [ServerName]: LCM:  [ Start  Test     ]  [[xWebVirtualDirectory]vd5]
2018-06-10T14:47:45.6417822Z VERBOSE: [ServerName]:                            [[xWebVirtualDirectory]vd5] Web virtual directory is in required 
2018-06-10T14:47:45.6417822Z state.
2018-06-10T14:47:45.6417822Z VERBOSE: [ServerName]: LCM:  [ End    Test     ]  [[xWebVirtualDirectory]vd5]  in 0.0470 seconds.
2018-06-10T14:47:45.6417822Z VERBOSE: [ServerName]: LCM:  [ Skip   Set      ]  [[xWebVirtualDirectory]vd5]
2018-06-10T14:47:45.6417822Z VERBOSE: [ServerName]: LCM:  [ End    Resource ]  [[xWebVirtualDirectory]vd5]
2018-06-10T14:47:45.6730704Z VERBOSE: [ServerName]: LCM:  [ Start  Resource ]  [[xWebVirtualDirectory]vd6]
2018-06-10T14:47:45.6730704Z VERBOSE: [ServerName]: LCM:  [ Start  Test     ]  [[xWebVirtualDirectory]vd6]
2018-06-10T14:47:45.6886510Z VERBOSE: [ServerName]:                            [[xWebVirtualDirectory]vd6] Web virtual directory is in required 
2018-06-10T14:47:45.6886510Z state.
2018-06-10T14:47:45.7042641Z VERBOSE: [ServerName]: LCM:  [ End    Test     ]  [[xWebVirtualDirectory]vd6]  in 0.0470 seconds.
2018-06-10T14:47:45.7042641Z VERBOSE: [ServerName]: LCM:  [ Skip   Set      ]  [[xWebVirtualDirectory]vd6]
2018-06-10T14:47:45.7042641Z VERBOSE: [ServerName]: LCM:  [ End    Resource ]  [[xWebVirtualDirectory]vd6]
2018-06-10T14:47:45.7198852Z VERBOSE: [ServerName]: LCM:  [ Start  Resource ]  [[xWebVirtualDirectory]vd7]
2018-06-10T14:47:45.7198852Z VERBOSE: [ServerName]: LCM:  [ Start  Test     ]  [[xWebVirtualDirectory]vd7]
2018-06-10T14:47:45.7511513Z VERBOSE: [ServerName]:                            [[xWebVirtualDirectory]vd7] Web virtual directory is in required state.
2018-06-10T14:47:45.7511513Z VERBOSE: [ServerName]: LCM:  [ End    Test     ]  [[xWebVirtualDirectory]vd7]  in 0.0470 seconds.
2018-06-10T14:47:45.7511513Z VERBOSE: [ServerName]: LCM:  [ Skip   Set      ]  [[xWebVirtualDirectory]vd7]
2018-06-10T14:47:45.7511513Z VERBOSE: [ServerName]: LCM:  [ End    Resource ]  [[xWebVirtualDirectory]vd7]
2018-06-10T14:47:45.7667672Z VERBOSE: [ServerName]: LCM:  [ Start  Resource ]  [[xWebVirtualDirectory]vd8]
2018-06-10T14:47:45.7667672Z VERBOSE: [ServerName]: LCM:  [ Start  Test     ]  [[xWebVirtualDirectory]vd8]
2018-06-10T14:47:45.7980302Z VERBOSE: [ServerName]:                            [[xWebVirtualDirectory]vd8] Web virtual directory is in required 
2018-06-10T14:47:45.7980302Z state.
2018-06-10T14:47:45.7980302Z VERBOSE: [ServerName]: LCM:  [ End    Test     ]  [[xWebVirtualDirectory]vd8]  in 0.0470 seconds.
2018-06-10T14:47:45.7980302Z VERBOSE: [ServerName]: LCM:  [ Skip   Set      ]  [[xWebVirtualDirectory]vd8]
2018-06-10T14:47:45.7980302Z VERBOSE: [ServerName]: LCM:  [ End    Resource ]  [[xWebVirtualDirectory]vd8]
2018-06-10T14:47:45.8136493Z VERBOSE: [ServerName]: LCM:  [ Start  Resource ]  [[Script]SetVirtualDirectoriesDefaults]
2018-06-10T14:47:45.8136493Z VERBOSE: [ServerName]: LCM:  [ Start  Test     ]  [[Script]SetVirtualDirectoriesDefaults]
2018-06-10T14:47:45.8605246Z VERBOSE: [ServerName]: LCM:  [ End    Test     ]  [[Script]SetVirtualDirectoriesDefaults]  in 0.0630 seconds.
2018-06-10T14:47:45.8605246Z VERBOSE: [ServerName]: LCM:  [ Skip   Set      ]  [[Script]SetVirtualDirectoriesDefaults]
2018-06-10T14:47:45.8605246Z VERBOSE: [ServerName]: LCM:  [ End    Resource ]  [[Script]SetVirtualDirectoriesDefaults]
2018-06-10T14:47:45.8605246Z VERBOSE: [ServerName]: LCM:  [ End    Set      ]
2018-06-10T14:47:45.9386357Z ##[error]The SendConfigurationApply function did not succeed.
    + CategoryInfo          : NotSpecified: (root/Microsoft/...gurationManager:String) [], CimException
    + FullyQualifiedErrorId : MI RESULT 1
    + PSComputerName        : x.x.x.x
 

2018-06-10T14:47:45.9386357Z VERBOSE: Operation 'Invoke CimMethod' complete.
2018-06-10T14:47:45.9386357Z VERBOSE: Time taken for configuration job to complete is 116.738 seconds
2018-06-10T14:47:45.9386357Z 

This is the configuration's xWebVirtualDirectory section:

xWebVirtualDirectory Vd1
{
	Name = 'Vd1'
	Website = $Node.WebSiteName
	WebApplication = ''
	Ensure = 'Absent'
	DependsOn = '[xWebsite]Web'
}

xWebVirtualDirectory Vd2
{
	Name = 'Vd2'
	Website = $Node.WebSiteName
	WebApplication = ''
	PhysicalPath = "\\ServerName\PathToVD\Vd2"
	Ensure = 'Present'
	DependsOn = '[xWebsite]Web'
}

xWebVirtualDirectory Vd3
{
	Name = 'Vd3'
	Website = $Node.WebSiteName
	WebApplication = ''
	PhysicalPath = "\\ServerName\PathToVD\Vd3"
	Ensure = 'Present'
	DependsOn = '[xWebsite]Web'
}

xWebVirtualDirectory Vd4
{
	Name = 'Vd4'
	Website = $Node.WebSiteName
	WebApplication = ''
	PhysicalPath = "\\ServerName\PathToVD\Vd4"
	Ensure = 'Present'
	DependsOn = '[xWebsite]Web'
}

xWebVirtualDirectory Vd5
{
	Name = 'Vd5'
	Website = $Node.WebSiteName
	WebApplication = ''
	PhysicalPath = "\\ServerName\PathToVD\Vd5"
	Ensure = 'Present'
	DependsOn = '[xWebsite]Web'
}

xWebVirtualDirectory Vd6
{
	Name = 'Vd6'
	Website = $Node.WebSiteName
	WebApplication = ''
	PhysicalPath = "\\ServerName\PathToVD\Vd6"
	Ensure = 'Present'
	DependsOn = '[xWebsite]Web'
}

xWebVirtualDirectory Vd7
{
	Name = 'Vd7'
	Website = $Node.WebSiteName
	WebApplication = ''
	PhysicalPath = "\\ServerName\PathToVD\Vd7"
	Ensure = 'Present'
	DependsOn = '[xWebsite]Web'
}

xWebVirtualDirectory Vd8
{
	Name = 'Vd8'
	Website = $Node.WebSiteName
	WebApplication = ''
	PhysicalPath = "\\ServerName\PathToVD\Vd8"
	Ensure = 'Present'
	DependsOn = '[xWebsite]Web'
}

Script SetVirtualDirectoriesDefaults
{
	DependsOn = "[xWebsite]Web"
	TestScript = {
		$WebSite = Get-Website -Name $using:Node.WebSiteName
		If (($WebSite.virtualDirectoryDefaults.userName -ne "") -and ($WebSite.virtualDirectoryDefaults.password -ne "")) {
			return $true
		}
		else {
			return $false
		}
	}
	GetScript = {
		# Do Nothing
	}
	SetScript = {
		$WebSiteName = $using:Node.WebSiteName
		$WebSitePath = "IIS:\Sites\"+$WebSiteName
		$WebSite = Get-Item $WebSitePath
		$WebSite.virtualDirectoryDefaults.userName = ******************
		$WebSite.virtualDirectoryDefaults.password = ******************
		$WebSite | Set-Item
	}
} 

@johlju
Copy link
Member

johlju commented Jun 11, 2018

It must be this command that fails. What happens if yu run that command manually? What error message, or prompt, do you get? It might be that it's missing a -Force?

https://github.com/PowerShell/xWebAdministration/blob/687808bff766cfbe87438c758801ac439d1b99ca/DSCResources/MSFT_xWebVirtualDirectory/MSFT_xWebVirtualDirectory.psm1#L143-L145

@Davidsod
Copy link
Author

Hi johlju,

I think I've found the problem, which is probably related to the fact that the virtual directory is under the website and not under specific application.

When I ran the command with -application "" (empty) it always prompt for an application.
Once i've replaced it to -application "/" it worked.

I'll test it soon with DSC and keep you posted.

David.

@johlju
Copy link
Member

johlju commented Jun 11, 2018

I hope it works, if it does the documentation should be updated. 🙂

@Davidsod
Copy link
Author

Good news my friend 👍 it worked!

2018-06-11T13:56:52.6672649Z VERBOSE: [ServerName]: LCM:  [ Start  Resource ]  [[xWebVirtualDirectory]Vd1]
2018-06-11T13:56:52.6672649Z VERBOSE: [ServerName]: LCM:  [ Start  Test     ]  [[xWebVirtualDirectory]Vd1]
2018-06-11T13:56:52.7610463Z VERBOSE: [ServerName]: LCM:  [ End    Test     ]  [[xWebVirtualDirectory]Vd1]  in 0.1040 seconds.
2018-06-11T13:56:52.7610463Z VERBOSE: [ServerName]: LCM:  [ Start  Set      ]  [[xWebVirtualDirectory]Vd1]
2018-06-11T13:56:52.8391689Z VERBOSE: [ServerName]:                            [[xWebVirtualDirectory]Vd1] Removing existing Virtual Directory "Vd1".
2018-06-11T13:56:52.9329236Z VERBOSE: [ServerName]: LCM:  [ End    Set      ]  [[xWebVirtualDirectory]Vd1]  in 0.1770 seconds.
2018-06-11T13:56:52.9329236Z VERBOSE: [ServerName]: LCM:  [ End    Resource ]  [[xWebVirtualDirectory]Vd1]

@johlju
Copy link
Member

johlju commented Jun 11, 2018

@Davidsod Awesome! 😃 Would you mind posing the working configuration (only the one resource that failed)? Just for reference

@johlju johlju changed the title xWebVirtualDirectory: interactive mode error xWebVirtualDirectory: Must specify '/ Jun 11, 2018
@johlju johlju changed the title xWebVirtualDirectory: Must specify '/ xWebVirtualDirectory: Must specify '/' for WebApplication when virtual directory is under the website Jun 11, 2018
@johlju johlju added help wanted The issue is up for grabs for anyone in the community. documentation The issue is related to documentation only. and removed needs more information The issue needs more information from the author or the community. labels Jun 11, 2018
@Davidsod
Copy link
Author

@johlju sorry for the delay, there you go:

xWebVirtualDirectory VD
{
	Name = 'VDName'
	Website = $Node.WebSiteName
	WebApplication = '/'
	PhysicalPath = "\\$Node.ServerName\Path"                
	Ensure = 'Absent'
}

The solution is the '/' instead of '':
WebApplication = '/'

@johlju
Copy link
Member

johlju commented Jun 18, 2018

@Davidsod Thank you, that should be documented.

@EklipZgit
Copy link

feels like the property shouldn't be required, and should use '/' by default if none is specified. Was very confusing to try to figure out how to add a vDir when I didn't have a WebApplication in the site, ended up finding this issue to realize I need to specify '/'. My 0.02

@caractacus
Copy link

caractacus commented Sep 6, 2019

Hi,

I am experiencing 'interactive mode' faults when running

Remove-WebVirtualDirectory -Filter "string" -Application "string" -Name "string" -Confirm:$false

The error occurs when the virtual directory contains content. When there is no content, the Remove-WebVirtualDirectory call succeeds in non-interactive mode.

An internal call to "Remove-Item" prompts to "remove all items". This prompt cannot be suppressed by setting $ConfirmPreference="None", or by using -Confirm:$false.

This is a critical issue for us as it prevents automated removal of LocalUser virtual directories for use with IIS Management authentication in an FTP site.

@johlju
Copy link
Member

johlju commented Sep 6, 2019

@caractacus that is outside the scope of this DSC resource module. Please submit an support case to Microsoft so they can help you resolve your issue.

A workaround would of course be to remove the content before removing the virtual directory.

@SteveL-MSFT SteveL-MSFT removed this from Help Wanted in powershell/dscresources Nov 27, 2019
tommysor added a commit to tommysor/WebAdministrationDsc that referenced this issue Nov 8, 2022
Make `Set-TargetResource` switch between `WebApplication` '' and '/' as required by `New-WebVirtualDirectory` and `Remove-WebVirtualDirectory` respectively.

Fix dsccommunity#331
Fix dsccommunity#366

Similar to old (2019) pr dsccommunity#533
tommysor added a commit to tommysor/WebAdministrationDsc that referenced this issue Nov 9, 2022
Make `Set-TargetResource` switch between `WebApplication` '' and '/' as required by `New-WebVirtualDirectory` and `Remove-WebVirtualDirectory` respectively.

Fix dsccommunity#331
Fix dsccommunity#366

Similar to old (2019) pr dsccommunity#533
tommysor added a commit to tommysor/WebAdministrationDsc that referenced this issue Nov 9, 2022
Make `Set-TargetResource` switch between `WebApplication` '' and '/' as required by `New-WebVirtualDirectory` and `Remove-WebVirtualDirectory` respectively.

Fix dsccommunity#331
Fix dsccommunity#366

Similar to old (2019) pr dsccommunity#533
tommysor added a commit to tommysor/WebAdministrationDsc that referenced this issue Nov 9, 2022
Make `Set-TargetResource` switch between `WebApplication` '' and '/' as required by `New-WebVirtualDirectory` and `Remove-WebVirtualDirectory` respectively.

Fix dsccommunity#366
tommysor added a commit to tommysor/WebAdministrationDsc that referenced this issue Nov 9, 2022
Make `Set-TargetResource` switch between `WebApplication` '' and '/' as required by `New-WebVirtualDirectory` and `Remove-WebVirtualDirectory` respectively.

Fix dsccommunity#366
johlju pushed a commit that referenced this issue Nov 12, 2022
- WebVirtualDirectory
  [Issue #366](#366)
  In WebVirtualDirectory WebApplication '' and '/' can now be used interchangeably.
  - Fixed Add WebVirtualDirectory when WebApplication = '/'.
  - Fixed Remove WebVirtualDirectory when WebApplication = ''.
@johlju johlju removed the help wanted The issue is up for grabs for anyone in the community. label Nov 12, 2022
Clay10J pushed a commit to Clay10J/WebAdministrationDsc that referenced this issue Dec 5, 2023
)

- WebVirtualDirectory
  [Issue dsccommunity#366](dsccommunity#366)
  In WebVirtualDirectory WebApplication '' and '/' can now be used interchangeably.
  - Fixed Add WebVirtualDirectory when WebApplication = '/'.
  - Fixed Remove WebVirtualDirectory when WebApplication = ''.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation The issue is related to documentation only.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants