Powershell script with different credentials

Hi everyone,
I am trying to get more into scripting and automating some processes via RoyalTS instead of using RDP sessions all the time.

Simple powershell script for now for monthly reboot of my windows server:
shutdown.exe /r /m $EffectiveComputerName /t 0

In the credential section I do have “Specify a credential name” and set to “MyDomainAdmin” which uses a smartcard certificate stored on my yubikey. For RDP it works fine, but for this script it seems like it does not use the credentials provided in the entry.

Is there something wrong with my setup? Do credentials for scripts have to be handled by the scripts itself?

Thanks for reaching out.

The credentials assigned to a PowerShell connection are currently used as username/password credentials for PowerShell Remoting through WSMan. Smart-card authentication configured for an RDP connection—including certificates stored on a YubiKey—is not passed to the PowerShell connection.

Supporting this would require a separate, interactive authentication and execution mechanism, including certificate selection, PIN/touch handling, a dedicated process running under the resulting Windows security token, and special handling for Direct Connect versus Royal Server execution. Because of these constraints, we currently have no short- to mid-term plans to implement this functionality.

As alternatives, you can:

  • Use a regular password-based administrative credential for the PowerShell connection.
  • Run the script using your current Windows/Kerberos identity, provided that identity has the required permissions.
  • For smart-card-only accounts, use an interactive runas /smartcard workflow or a preconfigured scheduled task or JEA endpoint on the remote server.

Please note that shutdown.exe does not accept separate credentials; it always runs under the security context of the process executing it.

Thanks for the fast response.

It is really refreshing talking to someone how actually knows the product and how it works.