Run PowerShell script and get service status for systems - Commvault, ADFS, DC

Rohit 0 Reputation points
2023-05-15T22:58:15.1366667+00:00

What would be the best method to run Get-Service (PowerShell script) without non-admin account

Microsoft Security Active Directory Federation Services
Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Anonymous
    2023-05-16T10:48:59.2833333+00:00

    Hi,

    Admin account is not required to run Get-Service. Use Invoke-Command if you want to run the command with the specified account.

    $cred = Get-Credential 
    Invoke-Command -ComputerName YourComputerName -Credential $cred -ScriptBlock {Get-Service}
    

    https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/invoke-command?view=powershell-5.1

    Best Regards,

    Ian Xue

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.