locked
Remote change cert at RDP windows server 2012 r2 RRS feed

  • Question

  • Try use Powershell to setup certificate RDP windows server 2012 R2 at 50+ servers.

    Use cmdlet

    Set-RDCertificate-RoleRDPublishing

    Using

    Invoke-Command 

    and have error


    A Remote Desktop Services deployment does not exist on TEST-TS01.reg.vtb24.ru. This operation can be performed after creating a deployment. For information a

    bout creating a deployment, run "Get-Help New-RDVirtualDesktopDeployment" or "Get-Help New-RDSessionDeployment".

    If run this script at host all ok.

    Upd.

    Invoke-Command -ComputerName test-ts01 -Credential user {ipmo RemoteDesktop;Set-RDCertificate -Role RDRedirector -ImportPath "c:\test\reg-ts2018.pfx" -Password $password -ConnectionBroker "$CB" -Force}



    • Edited by Dlibin Friday, November 30, 2018 6:13 AM
    Thursday, November 29, 2018 1:23 PM

All replies

  • Hi,

    Can you post your all invoke-command ?


    The key of learning is practice.

    Thursday, November 29, 2018 2:15 PM
  • Please use the code posting tool to post code so that it is readable

    Please remove colorized text and code by editing your original post.


    \_(ツ)_/

    Thursday, November 29, 2018 6:18 PM
  • Here is the correct way to format and post code:

    $sb = {
        Import-Module RemoteDesktop
        Set-RDCertificate -Role RDRedirector -ImportPath c:\test\reg-ts2018.pfx -Password $password -ConnectionBroker $CB -Force
    }
    Invoke-Command -ScriptBlock $sb -ComputerName test-ts01 -Credential user 


    You have not passed and variables to your command.  They will all be null.

    See:

    help Invoke-Command -online

    Read the complete help and review the examples to learn how to use the command.


    \_(ツ)_/


    • Edited by jrv Thursday, November 29, 2018 6:23 PM
    Thursday, November 29, 2018 6:22 PM
  • $password = Read-Host "Enter password" –AsSecureString
    
    $sb = {
        Import-Module RemoteDesktop
        Set-RDCertificate -Role RDRedirector -ImportPath c:\test\reg-ts2018.pfx -Password $password -ConnectionBroker test-ts01 -Force
    }
    Invoke-Command -ScriptBlock $sb -ComputerName test-ts01 -Credential domain\user

    Friday, November 30, 2018 7:33 AM
  • You have to either pass the password as an argument or do this: $using:password


    \_(ツ)_/

    Friday, November 30, 2018 7:41 AM
  • Friday, November 30, 2018 7:43 AM
  • We don't use HA mode and invoke command at main RD serever.
    Friday, November 30, 2018 8:47 AM