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

xRDCertificateConfiguration:The term ''Get-RDServer'' is not recognized #79

Closed
lkys37en opened this issue May 8, 2020 · 5 comments · Fixed by #98
Closed

xRDCertificateConfiguration:The term ''Get-RDServer'' is not recognized #79

lkys37en opened this issue May 8, 2020 · 5 comments · Fixed by #98

Comments

@lkys37en
Copy link

lkys37en commented May 8, 2020

ISSUE DESCRIPTION
I'm using Ansible to run the xRDCertificateConfiguration resource and only when applying a certificate to the RDWebaccess role I get the following error message.

Failed to invoke DSC Set method: Failed to apply certificate from path ''C:\windows\temp\rds-cert.pfx'' to role ''RDWebAccess'' on connection broker ''hostnamel''. Error: ''The term ''Get-RDServer'' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.'''

Suggested solution to the issue

I figured this was an issue due to the box not being ready so I added a delay of 60 seconds and 10 retires and unfortunately the result is the same.

The DSC configuration that is used to reproduce the issue (as detailed as possible)

  • name: Configure RDS Certificate
    win_dsc:
    Resource_name: xRDCertificateConfiguration
    Role: "{{ item }}"
    ConnectionBroker: "{{ hostname }}.{{ domain }}"
    ImportPath: C:\windows\temp\rds-cert.pfx
    Credential_username: Welcome1!
    Credential_password: Welcome1!
    PsDscRunAsCredential_username: "{{ domain_admin }}"
    PsDscRunAsCredential_password: "{{ domain_admin_password }}"
    with_items:
    • RDRedirector
    • RDPublishing
    • RDWebAccess

###Output of successfully applying a certificate to other roles
TASK [ad_rds : Configure RDS Certificate] ************************************************************************************************************************************************************************************************************************changed: [10.9.10.18] => (item=RDRedirector) => changed=true
ansible_loop_var: item
attempts: 1
item: RDRedirector
module_version: 2.0.0
reboot_required: false
changed: [10.9.10.18] => (item=RDPublishing) => changed=true
ansible_loop_var: item
attempts: 1
item: RDPublishing
module_version: 2.0.0
reboot_required: false

The operating system the target node is running

OsName : Microsoft Windows Server 2019 Standard
OsOperatingSystemSKU : StandardServerEdition
OsArchitecture : 64-bit
WindowsVersion : 1809
WindowsBuildLabEx : 17763.1.amd64fre.rs5_release.180914-1434
OsLanguage : en-US
OsMuiLanguages : {en-US}

Version and build of PowerShell the target node is running

Name Value


PSVersion 5.1.17763.771
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17763.771
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

Version of the DSC module that was used

Version 2.0.0

@danielboth
Copy link
Member

danielboth commented May 14, 2020

Ok, looking at the error message you get this goes wrong at this stage:

Set-RDCertificate, in the beginning of the code, indeed calls Get-RDServer (which seems to be unavailable in your error).

The reason it's possible that command cannot be found is not entirely clear to me, it could be related to the fact that in the module where this command is defined (C:\windows\system32\WindowsPowerShell\v1.0\Modules\RemoteDesktop\Deployment.psm1) it's called Get-Server, not Get-RDServer. The RD prefix is only added as soon as the RemoteDesktop module is loaded.

Since this module loads the RemoteDesktop module explicitly, I would not expect any issues there though, but in this case it's clear there are issues.

Would you be so kind to help testing a change in the code? Maybe if we load the module in the global context, this prevents the issue. What you would need to do locally on your machine is change this line:

and make it:
Import-Module -Name RemoteDesktop -Global

Then test it with your configuration. Thanks in advance!

@lkys37en
Copy link
Author

That worked! Thank you so much and thank you for not saying because you're using Ansible I can't help you ( =

@danielboth
Copy link
Member

Happy to hear that it worked, thank you for reporting back! To add to that, which tool you use, if it's Puppet, Chef, Ansible or plain DSC, that doesn't matter, in the end it's the DSC resource that needs to do the work.

@jeremyciak
Copy link

@danielboth are you looking for assistance in getting this fix implemented via a PR?

@uw-dc
Copy link
Contributor

uw-dc commented Jul 14, 2022

I hit this problem.
PR raised.

@danielboth, @johlju please could we get this merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants