Setting default printer remotely

I’m attempting to use PowerShell to set a default printer in Windows 2012 R2. This works fine every time whenever I do it locally, however regardless of how I attempt to run it remotely, which I need to do, it always fails with the below error. I’ve tried this with the Domain Administrator account as well as the user’s credentials who I need to change the default printer for, but it always fails with the following error:

Exception calling “SetDefaultPrinter” : "Not supported "
At line:1 char:1

  • $Printer.SetDefaultPrinter()
  •   + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : WMIMethodException

Working code when run locally

Can you show the code you’re running?