spjeff / spbestwarmup

Tired of waiting for SharePoint pages to load? Want something easy to support? That works on all versions? This warmup script is for you!
2 stars 0 forks source link

Get-WMIObject : Invalid namespace "root/MicrosoftIISv2 #26

Closed ecanales88 closed 3 years ago

ecanales88 commented 5 years ago

Hi, in SharePoint 2019 appears this error: "Get-WMIObject : Invalid namespace "root/MicrosoftIISv2"

Please, I use your warmup script since SharEPoint 2013 :)

thomasvochten commented 5 years ago

This happens because SharePoint Server 2019 does not need and therefore does not install the "IIS6 WMI Compatibility" feature in Windows Server 2019. Install that feature and it should work:

image

thomasvochten commented 5 years ago

@spjeff You might want to look at retrieving this information in another way... :-)

Frost-on-Web commented 4 years ago

I met the issue too. The script allows me to enter my admin password whatever and the task seems to be installed. Am I wrong to think the warm up is functional despite of the [ Get-WMIObject : Invalid namespace "root/MicrosoftIISv2" ] error ?

caellhen commented 4 years ago

It is my understanding that these two features are used in the deployment of the script. Thus, you can enable them in windows 2019 server in order to install it farm wide and then remove them.

SergeiAtML commented 3 years ago

i put try catch around the WMIcall and now the code just falls back to prompting for username and password. I submitted a pull request

spjeff commented 3 years ago

Thank you Sergei.

drullo commented 1 year ago

I'm not sure if this logic is still working for you all. But it is not working for me. The problem is that the solution implemented by @SergeiAtML relies on an exception being thrown and the catch block handling the password prompt, but no exception is ever thrown. So it falls out of the try/catch block and continues along with no password. Eventually when it gets to the schtasks command, it just hangs forever.

In my environment, I'm now checking for a null password after the logic that attempts to loop through app pools (which quietly "fails" without an exception). If the password is null at that point, I'm manually throwing an exception to kick it to the catch block so that the user can be prompted for a password. I also added an additional check after the password prompt to ensure that one was entered. If a password wasn't entered, a final exception is thrown, preventing the function from continuing without a password.