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

The resources should check is the RemoteDesktop module exists before loading it #6

Open
TravisEz13 opened this issue Feb 24, 2016 · 7 comments
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.

Comments

@TravisEz13
Copy link
Contributor

The resources should check is the RemoteDesktop module exists before loading it

@kwirkykat kwirkykat added enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community. labels Aug 18, 2016
@peppekerstens
Copy link

struggling a bit with what is expected as the RemoteDesktop module implicitly exists on a Windows server when function Test-xRemoteDesktopSessionHostOsRequirement from xRemoteDesktopSessionHostCommon.ps1 passes.

Only situation when this happens is when it is not called from a server OS. Should the Test-xRemoteDesktopSessionHostOsRequirement function be extended to test that?

Also, you cannot test on:

  • 'Get-WindowsFeature RSAT-RDS-Tools' as it is not needed to to import th module
  • 'Get-Module RemoteDesktop' as this yields no result on a server OS
  • 'Get-Package RemoteDesktop' as this yields to an errort on a server OS
  • Any of the "Find-' commands of the above, as this will show results from PSGallery which we do not want.

What remains:

  1. Extend the Test-xRemoteDesktopSessionHostOsRequirement function
  2. Use a Try/Catch or alike functionality on import itself
  3. Use the Get-Command -Module RemoteDesktop -> When present, this should show results

I propose a combination of 1 and 2....?

@johlju
Copy link
Member

johlju commented Aug 19, 2018

My thought is that Get-Module -Name RemoteDesktop -ListAvailable, if the module is in a $PSModulePath then this will return the module. If it does not exist, it will return $null (nothing).

Would that work?

@peppekerstens
Copy link

omg! you're so right! why didn't i think of that?
lets first close current PR; in next one..ok? :)

@johlju
Copy link
Member

johlju commented Sep 13, 2018

@peppekerstens It is always easier to have someone to bounce ideas with. You would have figured it out 🙂 No problem doing this in another PR.

@johlju
Copy link
Member

johlju commented Sep 14, 2018

@peppekerstens that's perfect to copy that helper function over here. :) Let's put it a module like it's done here (some folder structure and change the name accordingly).
https://github.com/PowerShell/CertificateDsc/tree/dev/Modules/CertificateDsc.ResourceHelper

@johlju
Copy link
Member

johlju commented Sep 14, 2018

@PlagueHO what's the difference between CertificateDsc.Common and CertificateDsc.ResourceHelper? 🤔
See https://github.com/PowerShell/CertificateDsc/tree/dev/Modules

If we should create a helper module here, what should we name it (to be consequent with template/other modules)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement The issue is an enhancement request. help wanted The issue is up for grabs for anyone in the community.
Projects
None yet
Development

No branches or pull requests

4 participants