PSD icon indicating copy to clipboard operation
PSD copied to clipboard

Unable to retrieve directory listing via https://URL/SHARE/Control WebDAV. Remote server returned error. (500) Internal Server Error

Open Xavierstarr opened this issue 1 year ago • 33 comments

Has anyone got the configuration needed for WebDAV to manually setup, found when running the IIS setup there is mention to rules needed in WebDav, but the script does not seem to apply any changes to WebDAV for the web instance in IIS.

I am finding that when we PXE Boot get error:

Unable to retrieve directory listing via https://URL/SHARE/Control WebDAV. Remote server returned error. (500) Internal Server Error

Can access the control directory when navigating via web browser fine from all machines when we install the certificate, any information on what config we need could help me troubleshoot this further.

Xavierstarr avatar Jan 13 '25 03:01 Xavierstarr

I do believe WebDav is still required. When you mentioned "manually setup", I assume your aren't using the New-PSDWebInstance.ps1 script provided? If so you must installed the WebDav Redirector feature:

image

After installing WebDav, run the Set-PSDWebInstance.ps1 to setup IIS and others items.

If your attempting to install PSD on a Windows 11 OS instead of a Server OS, the script will fail as WebDAV is already part of the OS. Also both of these scripts are running the server command Enable-WindowsFeature and not the Enable-WindowsOptionalFeature cmdlet;, so they won't work with Windows 11.

I would highly recommend running PSD on a Server OS and use the scripts as they set up a lot of things for IIS. I do have a script that maybe work on Windows 11, but this has not been officially tested by the PSD team either

Once WebDAV is installed, verify that the WebDAV is enabled. image

Then make sure the WebDav Authoring rules are in place (this should be done at each virtual directory.) image

Note my screenshots might be different than yours because I am testing Web Applications instead of Virtual Directories, but the settings are the same.

Also review this: https://github.com/FriendsOfMDT/PSD/issues/203

PowerShellCrack avatar Jan 13 '25 13:01 PowerShellCrack

The requirements for the solution are clear, only Windows Server OS is supported! Here is the link to the docs https://github.com/FriendsOfMDT/PSD/blob/master/Documentation/PowerShell%20Deployment%20-%20Installation%20Guide.md#psd-installer-supported-configurations

GeoSimos avatar Jan 13 '25 18:01 GeoSimos

Scripts were used, and this is a fresh Windows 2022 server VM.

Was just asking for the manual setup steps as I noticed in the docs it mentions the scripts are meant to setup authoring rules ECT. Which has not happened on the two installs I've tried via script on windows server, the manual setup info would help me troubleshoot these 500 and 400.1 errors I am seeing after enabling WebDAV logging manually.

Xavierstarr avatar Jan 13 '25 20:01 Xavierstarr

The configuration of a web instance is happening via this script https://github.com/FriendsOfMDT/PSD/blob/master/Tools/Set-PSDWebInstance.ps1, you will find all the rules after the functions.

GeoSimos avatar Jan 13 '25 22:01 GeoSimos

Did the above screenshots help? Recently, I have seen other issues opened with WebDav but haven't seen the issue in my testing. The logs may tell use more if you can share them. Each script will produce a log of the same name.

PowerShellCrack avatar Jan 19 '25 14:01 PowerShellCrack

Hi,

After resolved the "Control to" issue ( issue 209), i'm blocked to this webdav issue.

Authorite rule * is ok.

.* in Mime type is ok.

What's the next step to check ?

lyonelf avatar Feb 07 '25 10:02 lyonelf

Did the above screenshots help? Recently, I have seen other issues opened with WebDav but haven't seen the issue in my testing. The logs may tell use more if you can share them. Each script will produce a log of the same name.

Not too much I'm afraid, was already at that stage myself figured I must have been missing something obvious. I ended up parking this a bit myself as my focus is on other projects. Was even just considering dumping the VM and starting fresh even though it's a fresh server build just for this.

Xavierstarr avatar Feb 07 '25 12:02 Xavierstarr

Did you run the Set-PSDWebInstance.ps1 script as @GeoSimos mentioned? if so, please upload the log it created.

if not, there are a lot of things it doing that you would have to configure:

Image

PowerShellCrack avatar Feb 07 '25 17:02 PowerShellCrack

Here is my log, if it can help:

<![LOG[The Script was executed with commands: .\Set-PSDWebInstance.ps1 -psDeploymentFolder P:\PSDProd -psVirtualDirectory PSD]LOG]!><time="17:15:30.707+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:383" context="" type="1" thread="" file=""> <![LOG[The Current running computer is: P1MDTADT01]LOG]!><time="17:15:30.754+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:384" context="" type="1" thread="" file=""> <![LOG[The Current user is ****** and is an administrator]LOG]!><time="17:15:30.770+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:385" context="" type="1" thread="" file=""> <![LOG[Now configuring the WebDAV and IIS for the MDT share at P:\PSDProd with ]LOG]!><time="17:15:30.786+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:393" context="" type="1" thread="" file=""> <![LOG[Now confirming if the role is installed on the machine]LOG]!><time="17:15:30.801+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:102" context="" type="1" thread="" file=""> <![LOG[The role is installed on the machine]LOG]!><time="17:15:57.777+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:106" context="" type="1" thread="" file=""> <![LOG[Now confirming if the role is installed on the machine]LOG]!><time="17:15:57.793+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:102" context="" type="1" thread="" file=""> <![LOG[The role is installed on the machine]LOG]!><time="17:15:58.142+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:106" context="" type="1" thread="" file=""> <![LOG[Confirming the WebDav services are configured properly on ]LOG]!><time="17:15:58.161+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:239" context="" type="1" thread="" file=""> <![LOG[Attempt number 1 at connecting and starting the service]LOG]!><time="17:15:58.173+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:246" context="" type="1" thread="" file=""> <![LOG[We found Pilote du redirecteur client WebDav and are now attempting to set it to a running state]LOG]!><time="17:15:58.205+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:251" context="" type="1" thread="" file=""> <![LOG[We found WebClient and are now attempting to set it to a running state]LOG]!><time="17:15:58.254+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:256" context="" type="1" thread="" file=""> <![LOG[Succesfully Completed starting the required services.]LOG]!><time="17:15:58.572+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:270" context="" type="1" thread="" file=""> <![LOG[Now creating the Virtual Directory]LOG]!><time="17:15:58.572+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:279" context="" type="1" thread="" file=""> <![LOG[Succesfully created the Virtual Directory PSD this drive maps to P:\PSDProd]LOG]!><time="17:15:59.432+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:291" context="" type="1" thread="" file=""> <![LOG[Now enabling WebDav]LOG]!><time="17:15:59.448+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:293" context="" type="1" thread="" file=""> <![LOG[The Mime Type has not yet been added for virtual directories now adding...]LOG]!><time="17:16:04.672+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:302" context="" type="1" thread="" file=""> <![LOG[Enabling the Directory browsing]LOG]!><time="17:16:05.738+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:309" context="" type="1" thread="" file=""> <![LOG[Directory browsing has been enabled for the PSD]LOG]!><time="17:16:06.801+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:311" context="" type="1" thread="" file=""> <![LOG[Now configuring security settings for authentication]LOG]!><time="17:16:06.801+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:312" context="" type="1" thread="" file=""> <![LOG[Enabling Double Escaping]LOG]!><time="17:16:06.817+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:315" context="" type="1" thread="" file=""> <![LOG[Setting WEBDavSettings]LOG]!><time="17:16:10.955+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:331" context="" type="1" thread="" file=""> <![LOG[Setting the Authoring rules for Default MimeType]LOG]!><time="17:16:10.971+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:332" context="" type="1" thread="" file=""> <![LOG[Setting the Infinite Depth rules for the virtual directory]LOG]!><time="17:16:12.14+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:334" context="" type="1" thread="" file=""> <![LOG[Setting the the Infinite Depth rules for the Default Web Site]LOG]!><time="17:16:13.59+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:336" context="" type="1" thread="" file=""> <![LOG[Turning off the apply to WebDav setting for File Extensions - Allows it to be configured or altered as needed]LOG]!><time="17:16:14.98+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:338" context="" type="1" thread="" file=""> <![LOG[Turning off the Request filtering for Verbs on WebDav]LOG]!><time="17:16:16.160+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:341" context="" type="1" thread="" file=""> <![LOG[The script has completed running and took 0 Hours and 0 Minutes and 47 seconds]LOG]!><time="17:16:18.410+000" date="01-30-2025" component="Set-PSDWebInstance.ps1:405" context="" type="1" thread="" file="">

lyonelf avatar Feb 10 '25 13:02 lyonelf

Thanks for this. The only thing that stands out is the highlighted line did not run. I haven't fully tested to see if it will run or if the $MimeREsults has a value.

Image

Maybe run the command just to be sure.

$MimeREsults = Add-WebConfigurationProperty -PSPath "IIS:\Sites\Default Web Site\PSD" -Filter "system.webServer/staticContent" -Name "." -Value @{ fileExtension='.*'; mimeType='Text/Plain'}

Restart the WebRedirector service as well

PowerShellCrack avatar Feb 10 '25 13:02 PowerShellCrack

Yes, the .* was not present when i executed the script

Added manually last week

Image

lyonelf avatar Feb 10 '25 14:02 lyonelf

If all these are in place, I'm not sure what is going on. I don't think it has anything to do with the language difference. I would check

  • the C:\Windows\System32\inetsrv\config\applicationHost.config for any anomalies. (I searched for webdav in notepad++)

Image

  • Check the P:\PSDProd\web.config file make sure it contains
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <staticContent>
            <mimeMap fileExtension=".*" mimeType="Text/Plain" />
        </staticContent>
        <directoryBrowse enabled="true" />
        <security>
            <requestFiltering allowDoubleEscaping="true" />
        </security>
    </system.webServer>
    <system.web>
        <authentication mode="Windows" />
    </system.web>
</configuration>
  • Make sure WebvDav service configurations are correct (https://learn.microsoft.com/en-us/iis/publish/using-webdav/using-the-webdav-redirector#webdav-redirector-registry-settings)

Image

After that I have no clue....

PowerShellCrack avatar Feb 11 '25 00:02 PowerShellCrack

The applicationhost.config is fully in english so nothing different i suppose to

web.config is ok too

Image

HKLM services is ok too ... damn

lyonelf avatar Feb 11 '25 08:02 lyonelf

What about windows authentication? I don't see that. I believe that is required as it's using the system to do authentication

PowerShellCrack avatar Feb 11 '25 12:02 PowerShellCrack

maybe it's that.

i copy paste your web.config and i'll retry

Wait and see

lyonelf avatar Feb 11 '25 14:02 lyonelf

Same red screen but it talk me about /Templates folder and not /Control folder ...

lyonelf avatar Feb 13 '25 10:02 lyonelf

I'm not understanding what you mean? Your missing the Template and Control folder?

PowerShellCrack avatar Feb 13 '25 13:02 PowerShellCrack

i have the same red message with error 500 but now it's not the Control folder that is write but Templates folder

Image

lyonelf avatar Feb 13 '25 14:02 lyonelf

what does your permissions look like under the deployment share? Does the account specified in the bootstrap.ini have Full access to the folder and subfolders?

PowerShellCrack avatar Feb 13 '25 14:02 PowerShellCrack

I would also like to know if you migrated to PSD 2.30 properly? The install script does not do these things:

  • All Task sequence must be migrated to PSD Client template or PSD server template format (this is a required for ALL PSD deployments)

Image

  • CustomSettings.ini and Bootstrap.ini must start by using the new template provided in the INIFiles folder. then you can add more/less rules if you like. this is particularly important for the properties section at the top.

If not follow these guides:

  • https://github.com/FriendsOfMDT/PSD/blob/CurrentDev/Documentation/PowerShell%20Deployment%20-%20Operations%20Guide.md
  • https://github.com/FriendsOfMDT/PSD/blob/CurrentDev/Documentation/PowerShell%20Deployment%20-%20Latest%20Release%20Setup%20Guide.md

PowerShellCrack avatar Feb 13 '25 14:02 PowerShellCrack

what does your permissions look like under the deployment share? Does the account specified in the bootstrap.ini have Full access to the folder and subfolders?

Yes, and it's a local mentionned like that

[Default] DeployRoot=http://P1MDT/PSD UserDomain=P1MDT UserID=MDT_BA UserPassword=Pass***

  • i have never updated the server, just installed it with the latest release, and copy paste all sequences, packages, drivers, ... from the MDT Dep Share to the PSD Dep share

lyonelf avatar Feb 13 '25 14:02 lyonelf

what does your permissions look like under the deployment share? Does the account specified in the bootstrap.ini have Full access to the folder and subfolders?

Yes, and it's a local mentionned like that

[Default] DeployRoot=http://P1MDT/PSD UserDomain=P1MDT UserID=MDT_BA UserPassword=Pass***

* i have never updated the server, just installed it with the latest release, and copy paste all sequences, packages, drivers, ... from the MDT Dep Share to the PSD Dep share

in my environment, im using the IP address as the URL to the deployment share ( so "http://# . # . # . #/psDeploymentShare" )

Unless you are using multiple servers mirroring this PSD setup and need redundancy just statically set the IP address of the server in:

  1. the server's network interface card settings
  2. in IIS manager network binding settings for your deployment share
  3. the bootstrap.ini file for your deployment share path

Otherwise you'll need to make sure you have your local DNS server setup to map your deployment share path to any server that hosts this PSD setup in your enviroment (having this running on a Windows Server in an Active Directory domain environment can make it easier, as the DNS role is needed for active directory membership of computers to properly function and updates the DNS records automatically).

If you still need some security, make sure to only allow the necessary traffic to the IP address that your server has statically set using VLANS and/or firewall access control policies.

MDA400 avatar Feb 14 '25 16:02 MDA400

IP address or DNS one is the same result.

lyonelf avatar Feb 17 '25 08:02 lyonelf

In your screenshot I see that DeployRoot is not being populated. Does it populate in the BGInfo screen during bootup? Also are you including DeployRoot in your BootStrap.ini [Settings] section under Properties? If you are, this will fail to process that property.

However, an error 500 sounds like an IIS issue. I would check you IIS logs for error 500. Also make sure the App pool is started. Try a iisreset as well. https://techcommunity.microsoft.com/blog/iis-support-blog/http-500-internal-server-errors-understanding-and-log-collection-for-effective-a/4240973

PowerShellCrack avatar Feb 17 '25 15:02 PowerShellCrack

Actually, i've completely deleted the shared folder and the IIS redirect site, to restart near the beginning.

So i repassed the Install-PSD.ps1 and the New-PSDWebInstance

-With an HTTP link, it's ok i can deploy a PC

-With an SMB$ method, i'm blocked at this step

Image

-With an HTTPS and Deployroot value in settings, i go back to a previous issue " validate xxxx to " without the share name. -With an HTTPS link without Deployroot in settings, it seems to be ok, the 1st test is in action

So this is actually my bootstrap config

Image

lyonelf avatar Feb 17 '25 17:02 lyonelf

Which repo branch are you using BTW?

PowerShellCrack avatar Feb 17 '25 18:02 PowerShellCrack

if you started from scratch why does your BootStrap.ini have PSDDeployRoots in the Properties? That is not in the provided BootStrap.ini

Image

PowerShellCrack avatar Feb 17 '25 18:02 PowerShellCrack

What PSDWizard is doing during that Task sequence selection and pulling the imported OS GUID from the ts.xml and then checking to see that exists in the Operating Systems.xml which is process by the MDT module into a PSDrive. Can you check you make sure the TS folder and TS.xml is in the Cache under X:\MININT\Cache\Control\<TSID>\ts.xml

PowerShellCrack avatar Feb 17 '25 18:02 PowerShellCrack

-which repo: the release available 2 weeks ago no new DL since.

-I copy passed my previous bootstrap to don't need to retype everything

-will see thursday

lyonelf avatar Feb 18 '25 08:02 lyonelf

what does your permissions look like under the deployment share? Does the account specified in the bootstrap.ini have Full access to the folder and subfolders?

And the error states that it can't do "directory listing" on the specific url, is it properly enable for those folders on IIS?

GeoSimos avatar Feb 18 '25 14:02 GeoSimos