Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Management.Automation;
- using System.Collections.ObjectModel;
- namespace ConsoleApplication1
- {
- class Program
- {
- static void Main(string[] args)
- {
- PowerShell ps = PowerShell.Create();
- ps.AddCommand("Get-Process");
- Collection<PSObject> results = ps.Invoke();
- foreach (PSObject result in results)
- {
- if (result != null)
- {
- Console.WriteLine(result.ToString());
- }
- }
- Console.Read();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement