JEA - get-service output commandRSS

3 replies

Last post Nov 15, 2019 05:42 AM by Jalpa Panchal

  • JEA - get-service output command

    Nov 13, 2019 12:10 PM|JoeRGlasgow|LINK

    I have setup JEA and got it working fine.  Now I need to tweak it for the output.

    I can get this to work fine

    Get-Service -ComputerName Server service

    this works also works fine

    Get-Service -ComputerName Server service | select Name

    But it falls over If I do this

    Get-Service -ComputerName Server service | select Status

    error:
    Cannot validate argument on parameter 'Property'. The argument "status" does not belong to the set
    "ModuleName,Namespace,OutputType,Count,HelpUri,Name,CommandType,ResolvedCommandName,DefaultParameterSet,CmdletBinding,Parameters" specified by the ValidateSet attrib
    ute. Supply an argument

    How do i get it to be able to output all the switches. Ideally I would like to be able to do this via JEA

    Get-Service -ComputerName server service | select -property MachineName, Name, DisplayName, starttype, Status | Format-Table

    but Cant figure out how to get the above.

  • Re: JEA - get-service output command

    Nov 14, 2019 07:22 AM|Jalpa Panchal|LINK

    Hi,

    It looks like the JEA issue.this is the expected behavior for custom functions.

    You could refer to this GitHub issue:

    https://github.com/PowerShell/JEA/issues/26

    You could create a custom function by using the FunctionDefinitions field. 

    https://docs.microsoft.com/en-in/powershell/scripting/learn/remoting/jea/role-capabilities?view=powershell-6#creating-custom-functions

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
  • Re: JEA - get-service output command

    Nov 14, 2019 02:54 PM|JoeRGlasgow|LINK

    Hi, thanks for that. Not too clued up on functions. I have the following added to the JEA sessions but it doesnt seem to work. It shows the function as avilable when I do get-command


    Function GET-NewService
    {
    Param (
    [Paramter(Madatory=$true)]
    [string] $srv,
    [string] $svc
    )

    get-service -Computername $srv -Name $svc | select Name, Status, StartType

    }

  • Re: JEA - get-service output command

    Nov 15, 2019 05:42 AM|Jalpa Panchal|LINK

    Hi,

    this is not iis issue so I suggest you to post on JEA GitHub.

    .NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.