IIS PowerShell Query RRS feed

  • Question

  • I have following event log and i would like to run a powershell script which would check the site code, in this site code is 4. After checking the code, powershell should try to start the site 4. can anyone help with the code.

    Log Name:      System 

    Source:        Microsoft-Windows-IIS-W3SVC 

    Event ID:      1004 

    Level:         Error 

    The World Wide Web Publishing Service (WWW Service) did not register the URL prefix https://*:445/ for site 4. The site has been disabled. The data field contains the error number. 

    Monday, September 2, 2019 2:05 PM


All replies

  • Hello Pankaj, 

    Do you have a sample code to discuss? 

    Otherwise, please refer to Forum Guidelines:

    The purpose of this forum is to get answers to scripting questions rather than to ask others to write or rewrite scripts for you. 


    Best regards, 


    • Marked as answer by Pankaj Parmar Friday, September 6, 2019 11:48 AM
    Monday, September 2, 2019 2:37 PM
  • help get-winevent -online

    Search for articles on how to use the event log with PowerShell.


    Monday, September 2, 2019 2:47 PM
  •  did not register the URL prefix https://*:445/ for site 4. The site has been disabled.  

    That will never work. Port 445 is for SMB. Your site will never start. 

    Even if you used 445 to get a sample failure event, and I suspect that this is a typo and you meant to use 443, the port number is irrelevant. Some other process is already listening on the port specified in the event. You would need to analyze what process is listening on it and kill it.  To me that indicates that you have something else going on your server that is very wrong and goes beyond writing a script. 

    Perhaps if you would provide more details of your situation, someone could offer some suggestions. 

    • Edited by MotoX80 Monday, September 2, 2019 10:55 PM
    Monday, September 2, 2019 10:51 PM
  • The correct format for registering a header for SSL is *:443  

    Only one site can be registered with this port.  

    See: https://www.ionos.com/community/server-cloud-infrastructure/windows-server/add-a-website-to-windows-server-2016-using-host-headers/

    I noted that "forums.iis.net" is the correct site for asking this kind of question since they wrote the IIS and the PowerShell module.  They will help you discover what you are doing wrong and show you to all of the documentation for IIS management and PowerShell.


    Monday, September 2, 2019 11:08 PM