The-Virtual-Desktop-Team / Virtual-Desktop-Optimization-Tool

The script and configuration files in this repository provide an easy method to customize and apply performance related settings to virtual desktop environments.
687 stars 174 forks source link

Exclusion of Services via "VDIState":"Disabled" not working #31

Closed marcfischer closed 3 years ago

marcfischer commented 3 years ago

Hi VDI-Team,

I love your Script. But I just figured out, that WSearch is disabled on my optimized Image, although is is configured in the Services.json like this:

  {
    "Name": "WSearch",
    "VDIState": "Unchanged",
    "URL": "https://docs.microsoft.com/en-us/windows/win32/search/-search-3x-wds-overview#windows-search-service",
    "Description": "Windows Search service provides content indexing, property caching, and search results for files, e-mail, and other content."
  },

In Win10_VirtualDesktop_Optimize you use this line to read the Services from the file: $ServicesToDisable = Get-Content .\ConfigurationFiles\Services.json | ConvertFrom-Json | Where-Object { $_.VDIState -eq 'Disabled' }

But this does only check if any Entry of the file has $_.VDIState -eq 'Disabled' and will not exclude other ones.

Maybe is is better to import each line with foreach.

Best Regards Marc

tmmuessig commented 3 years ago

Hi Marc,

We were alerted to this issue a few weeks ago and have fixed it and pushed this change to the master branch. There was a problem with how the where object was evaluating. Can you please grab the latest code and see if it resolves the issue for you?

Tim

marcfischer commented 3 years ago

Hi Tim,

okay, this was my fault, hav not seen that there was a new version. Now everything works fine! Even without the parameter -All $true Thank you for your work and have a good XMas time.

Marc