1

I'm having an issue with the Print Spooler getting hung up on a Hyper-V server that im running and tickets get hung up...Im just trying to streamline this by figuring out how i can just run a powershell script without having to enter any credentials manually. I can get a powershell script to accomplish this but the only one that i have found implements the Get-Credentials and prompts to enter credentials then i get put into a remote Powershell session on the server where i can restart the service from there.

Is there an easier way to accomplish what i am trying to do?

7
  • Will you be running this script using an account that's local admin on the target Hyper-V server? Commented Oct 6, 2020 at 17:23
  • Yes I will. i actually am just using the Administrator account to try and accomplish this. Commented Oct 6, 2020 at 17:28
  • If you launch PowerShell with a domain account that has local admin on the remote box, then you don't need to provide credentials again. Simply do Restart-Service -Name spooler -ComputerName hyperv-server.domain.fqdn or Invoke-Command {Restart-Service -Name spooler} -ComputerName hyperv-server.domain.fqdn, PowerShell will simply default to the callers network identity when no explicit credentials are passed Commented Oct 6, 2020 at 17:34
  • Using Invoke-Command {Restart-Service -Name spooler} -ComputerName hyperv-server.domain.fqdn I get Access Denied. Commented Oct 6, 2020 at 19:01
  • 1
    Please update your post, comments aren't well fit for code :) FWIW, you just need to remove -credential (get-credential) do avoid the prompt, but if you're getting access denied, then there's something else wrong. Are both servers joined to the same domain/forest? Commented Oct 6, 2020 at 19:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.