none
New to powershell

Answers

All replies

  • Hi,

    Please try:

    Get-Service |where {$_.status -eq "stopped"}

    Regards,

    Yan Li


    Cataleya Li
    TechNet Community Support

    Monday, December 03, 2012 2:16 AM
  • Thanks you for the help. It work fine, the only thing is that it had more than Microsoft services. I try this

    Get-microsoftservice |where {$_.status -eq "stopped"} it didnt work what did i do wrong.

    Thanks,

    EeKk

    Monday, December 03, 2012 1:36 PM
  • There is not commandlet called Get-Microsoftservice in powershell.

    You can either use get-service or you can use WMI Queries like get-wmiobject win32_service.

    Please let us know what are you trying to acheive here.

    Regards,

    _Prashant_


    MCSA|MCITP SA|Microsoft Exchange 2003 Blog - http://prashant1987.wordpress.com Disclaimer: This posting is provided AS-IS with no warranties/guarantees and confers no rights.

    Monday, December 03, 2012 2:29 PM
  • This is what I'm trying to achieve

    Create a command that will get a list of all the stopped services that are Microsoft services. I just want Microsoft service to show nothing else.

    Thanks,

    EeKk

    Monday, December 03, 2012 2:32 PM
  • gwmi win32_service -Filter "State='Stopped'"  | ? {(gi ($_.pathname.trim('"') -replace "(\.exe).+",'$1')).VersionInfo.CompanyName -match "Microsoft"}

    Monday, December 03, 2012 2:52 PM
  • That didn't do what I was looking for.

    Thanks,

    EeKk


    R Jones

    Monday, December 03, 2012 3:54 PM
  • # add | gsv to get an array of service objects
     
    gwmi win32_service -Filter "State='Stopped'"  | ? {(gi ($_.pathname.trim('"') -replace
    "(\.exe).+",'$1')).VersionInfo.CompanyName -match "Microsoft"} | gsv
     
     
    Monday, December 03, 2012 4:02 PM
  • All i want to show up is Microsoft that's is all. Not the other service.

    Thanks,

    EeKk


    R Jones

    Monday, December 03, 2012 4:05 PM
  • I don't know what you mean by that.
    Can you describe what you mean by "Microsoft services" ?
     
    - Larry
     >
     >
    On 12/3/2012 10:05 AM, EeKk-Enterprise wrote:
    > All i want to show up is Microsoft that's is all. Not the other service.
    >
    > Thanks,
    >
    > EeKk
    >
    > ---------------------------------------------------------------------------------------------------
    >
    > R Jones
    >
     
     
    Monday, December 03, 2012 4:34 PM
  • This is want i was looking for

    display name: is where i need only Microsoft services. I don't want other services in that.

    Thanks,

    EeKk


    R Jones

    Monday, December 03, 2012 4:38 PM
  • You need to to be more specific.
    Can you give examples of some Microsoft services?
     
    Monday, December 03, 2012 5:27 PM
  • Status                   name                                    displayname

    Stop                       clr_optimisation…            Micosoft.net framework negen v2.0….

    Stop                       swprv                                    Microsoft software shadow copy prov…

    Thanks,

    EeKk


    R Jones

    Monday, December 03, 2012 5:32 PM
  • I think Kazuns method is the way to go...

    gwmi win32_service -Filter "State='Stopped'"  |
         ? {(gi ($_.pathname.trim('"') -replace "(\.exe).+",'$1')).VersionInfo.CompanyName -match "Microsoft"} |
         Select Status,Name,DisplayName

    You said that didn't do what you wanted... what isn't it doing?

    Admiral Ackbar says...

    Monday, December 03, 2012 6:08 PM
  • It not giving me just Microsoft services.

    Thanks,

    EeKk


    R Jones

    Monday, December 03, 2012 6:43 PM
  • From the output of the above code, can you list the services are not Microsoft services.

    The script is doing this:

    Get all the services that are stopped

    For each of the services, find the file information of the executable.

    If the Company name in the file information contains 'Microsoft' then list the service.

    I find it hard to see how it is listing non-Microsoft services.


    Admiral Ackbar says...

    Monday, December 03, 2012 6:54 PM
  •  
    gsv | ?{$_.displayname -like '*Microsoft*' -and $_.status -eq 'Stopped'}
     
    Monday, December 03, 2012 6:55 PM
  •  

    Thank you so much that was what i was looking for.

    I did this:

    get-service -include microsoft* | sort -property status

    Thanks,

    EeKk


    R Jones

    Monday, December 03, 2012 8:10 PM
  • Larry Weiss can you help me with this problem I'm having. Here it goes.

    Create a command that displays all processes with working set. Make the working set display in MB and label it as such.

    Want it to look like this

    ProcessName WorkingSet (MB)

    XXXXX x.xxxxxxxxxxxxx

    I know i need a variable to do such a thing I just not sure how to pull it off.

    Thanks,

    EeKk


    R Jones

    Monday, December 03, 2012 9:15 PM
  • Please start a new topic for this with matching subject text.
     
    And, it is not appropriate to request help from a particular person.
    You will get better and more timely help if you leave it open for anyone to answer.
     
    Also, when you create the new topic, show the PowerShell commands you have already tried that would
    solve your request.
      - Larry
     >
     >
    On 12/3/2012 3:15 PM, EeKk-Enterprise wrote:
    > Larry Weiss can you help me with this problem I'm having. Here it goes.
    >
    > Create a command that displays all processes with working set. Make the working set display in MB
    > and label it as such.
    >
    > Want it to look like this
    >
    > ProcessNameWorkingSet (MB)
    >
    > XXXXXx.xxxxxxxxxxxxx
    >
    > I know i need a variable to do such a thing I just not sure how to pull it off.
    >
    > Thanks,
    >
    > EeKk
    >
    > ---------------------------------------------------------------------------------------------------
    >
    > R Jones
    >
     
     
    Tuesday, December 04, 2012 3:13 PM