locked
Powershell script - Get status of Server RRS feed

  • Question

  • I am new to powershell scripting and only have used Shell/Perl scripting in UNIX. I am trying to create a powershell script to check if a specific server is running (Postgres SQL Server 9.2).

    I understand that within the command line how to get the name & status of a specific server "Get-Service -Name pgsql-9.2" and it will return what I expect.

    Status         Name                 DisplayName
    ----------      --------                ----------------
    Running      pgsql9.2             pgsql9.2 -  Postgres SQL Server 9.2

    I have seen scripts online and have tried to use this but doesn't seem to return anything to do with the postgres server only other servers.

    Any help would be greatly appreciated 

    Thanks in advance

    Thursday, November 9, 2017 11:50 AM

All replies

  • It has returned what you ask.  What are you expecting?


    \_(ツ)_/

    Thursday, November 9, 2017 7:00 PM
  • Hey, If you want to check the service running on the remote server, you will need to add -computerName parameter.
    Get-Service -Name pgsql-9.2 -ComputerName RemoteServerName
    
    Hope this is what you are looking for.
    Thursday, November 9, 2017 10:31 PM