I suspect that your remote session has the screen locked. If you Google that exception (the stack trace indicates the problem is in the method below), you can see several suggestions that this can occur because the screen is locked or otherwise not "on".
@EstebanS0841 I would suggest making sure the VM is unlocked. If the screen is locked, then according to what I have read, that method does not work. That would make sense since a screenshot of a locked machine would be the lock screen which isn't likely what you are trying to capture anyway. You can use the RPA Service to login to your machine and a script like the one below to keep the screen from locking. This would not prevent the screen from locking if you were to connect and then disconnect though, but in normal unattended operation, your machine would always be unlocked.