locked
New to PowerShell - help please RRS feed

  • Question

  • Hello,

    I am new to Powershell and I was given a few tasks to resolve by using Powershell.

    I have managed to respond to the first two.

    Could you please help me with the last two?

    Many thanks,

    _______________________
    Tasks to resolve with the help of PowerShell: 

    1. List all the processes running on your PC.
    2. List all the services on your PC and display their PID. * Hint: WMI.
    3. For each process found, check if there is a service and list the processes that have services and their PID's.
    4. List processes that do not have services and their PID's.

    Solutions:

    1. Get-process

    2. Get-WmiObject -class win32_service | select name, processid 

    3. ???

    4. ??? 

    Friday, April 27, 2018 3:35 PM

All replies

  • Is this homework or something? Learn PowerShell and all will become clear :)

    Why are you using get-wmiobject for the services on your local machine? use get-service.


    Learn PowerShell                     Script Requests

    -Remember to mark the correct response as the answer-

    Friday, April 27, 2018 3:46 PM
  • It is not homework.

    At work, we were ask if we could resolve the above tasks by using powershell, without having any experience in using powershell. I decided to try to resolve them, just for fun, by using what I can find on the internet. I have a deadline for this and I cannot figure how to resolve the last two. 

    If possible, could you please help me with that?

    Friday, April 27, 2018 3:53 PM
  • It is not homework.

    At work, we were ask if we could resolve the above tasks by using powershell, without having any experience in using powershell. I decided to try to resolve them, just for fun, by using what I can find on the internet. I have a deadline for this and I cannot figure how to resolve the last two. 

    If possible, could you please help me with that?

    This is odd as using any technology requires first learning the technology.  YOu issues with work requirements are not of interest in this forum.  If you have serious requirements then you would need to contact a consultant for help.

    The issue of finding a process that is a service is simple.  Just get all services and display their processes.

    Get-WmiObject Win32_Service |%{Get-Process -Id $_.ProcessID} | Select ID, Name

    Now just match all services with all processes by ID and you have the last question.


    \_(ツ)_/

    Friday, April 27, 2018 5:49 PM
  • Hello,

    Can you please help me to list in powershell processes that do not have services and their PID's? 

    Thank you, 

    • Merged by jrv Monday, April 30, 2018 1:08 PM DUPLICATE
    Monday, April 30, 2018 12:51 PM