PowerShell Windows Forms Tutorial 2 : Process Manager

  Рет қаралды 19,278

SX86 - PowerShell.toGUI

SX86 - PowerShell.toGUI

Күн бұрын

Пікірлер: 108
@danielalt7508
@danielalt7508 6 жыл бұрын
I like the quality videos you make. Sharp camera, good black theme on ISE and what I love most: POWERSHELL
@thecrimsonraven707
@thecrimsonraven707 7 жыл бұрын
Great work with the tutorial video. I like how you step through each command.
@SX86.ps1
@SX86.ps1 7 жыл бұрын
+Peter DaSilva thanks for your feedback!
@EdResleff
@EdResleff 5 жыл бұрын
Really enjoyed learning how to do GUI with PowerShell through watching these...! At this particular time I don't have a need to create forms, but I am getting ready to refactor a current script which does employ a form and this certainly helps...!
@SX86.ps1
@SX86.ps1 5 жыл бұрын
Always nice to hear! Glad I could teach you something 😀
@EdResleff
@EdResleff 5 жыл бұрын
@@SX86.ps1 We all learn from each other...!
@snappykr22
@snappykr22 7 жыл бұрын
great tutorial. good balance between explaining something without over-explaining. this makes for shorter videos and keeps focus on the main point.
@decnine
@decnine 7 жыл бұрын
Your videos are awesome and it's one of the best tutorials I have seen . Much appreciated. Keep it up and thanks for sharing.
@SX86.ps1
@SX86.ps1 7 жыл бұрын
+decnine thank you! I've been putting off making new videos for a month now...maybe I need to get to work! Is there anything that you would like to see?
@Abydos33RA
@Abydos33RA 5 жыл бұрын
It still helped a lot. Many thanks. Hope all is well with family.
@SX86.ps1
@SX86.ps1 5 жыл бұрын
Glad you enjoyed it. Thanks for checking in!
@frankdelbuono6903
@frankdelbuono6903 Жыл бұрын
Please post any tutorials on multiple checkbox selections from one or multiple forms where you can pick and choose what options to consider and then with the options you select be able to call functions to process those options.... Great work!
@dba3579
@dba3579 3 жыл бұрын
Good information. Will definitely come in handy. Can the ListViewGrid store images? (i.e. .PNG, .JPG, etc.) - Thanks
@davidodell2733
@davidodell2733 5 жыл бұрын
I really loved the first two tutorials, EXCELLENT!!! However, I don't think you noticed but after you stop one of the processes, it is not clearing it from the process list. Look back on your video at 30:01. This is AFTER you've run the End Selected Processes. You'll notice that ID 2196 is still present in the list.
@Frigol33tGaming
@Frigol33tGaming 7 жыл бұрын
Another great video, please keep up this good work :)
@SX86.ps1
@SX86.ps1 7 жыл бұрын
+Kevin Rehnberg thanks for your feedback! Glad you enjoyed it.
@JayeshPatel-sf9mz
@JayeshPatel-sf9mz 3 жыл бұрын
Great video to describe the use of list view, Thanks Good Job :)
@geertvancompernolle2586
@geertvancompernolle2586 6 жыл бұрын
Followed part 1 and part 2 now, great PowerShell intro! Could you tell me what theme you're using in PowerShell? Looks relaxing for the eyes...
@SX86.ps1
@SX86.ps1 6 жыл бұрын
Sure! Here it is : github.com/SX86/PowerShell/blob/master/MaterialDark.StorableColorTheme.ps1xml
@geertvancompernolle2586
@geertvancompernolle2586 6 жыл бұрын
Awesome! Already applied and looks indeed much more relaxing compared to the standard theme. Tnx very much!
@urgotera
@urgotera 7 жыл бұрын
Very edutaining! Thanks!
@ctnahmet
@ctnahmet 5 жыл бұрын
Thanks for great tutorial and sharing the content.
@alanelston2330
@alanelston2330 2 жыл бұрын
Regarding the script section adding the listView control I notice a couple of differences between the script in the video and the one given at PasteBin _ The first line in the PasteBin script has $Global:listview_Processes rather than $listview_Processes _ In the PasteBin script you have an extra Add_ColumnClick({SortListView $_.Column}) What is the purpose of those two changes?
@Max-gd3wj
@Max-gd3wj 2 жыл бұрын
Ty sooo much, it really helped me for a project in my school
@alanelston2330
@alanelston2330 2 жыл бұрын
If I stop a Process, and that causes my computer to crash, would that do any permanent damage, or would it sort itself out on a restart?
@SX86.ps1
@SX86.ps1 2 жыл бұрын
It should sort itself out on restart. Which process are you stopping?
@alanelston2330
@alanelston2330 2 жыл бұрын
@@SX86.ps1 Hi. I wasn't stopping any in particular, yet. - I was thinking of experimenting a bit, and so was just checking before I start.
@alanelston2330
@alanelston2330 2 жыл бұрын
1 of 10 I just worked through in detail functions GetProcesses and EndProcesses. I did this while watching a few times this video. A combination of that watching, pausing, replaying, repeating some of your extra explanations/ Cmdlet in the PowerShell in parallel, liberally adding a few write-hosts, reading and expanding on your extra # comments ... etc. - that all made this a fantastic learning experience, as close as one can probably get to having a personal Tutor. I learnt a hell of a lot. Thx, Alan Here following some minor comments and questions resulting from that. ( I expect I will have difficulty getting all info across without that damm KZbin Police Bot making false positives and deleting some posts)
@alanelston2330
@alanelston2330 2 жыл бұрын
2 of 10 You explained why you did $listview_Processes.Items.Clear() That was to prevent rows being continually appended by every re - run but I did not notice an explanation for $listview_Processes.Columns.Clear() but I think I see that this is to prevent re - runs adding more columns again? Certainly by trying leaving that out, that is what appeared to happen: I get another set of empty columns, so that is of little use ( I can think it might be sometimes useful to append rows, for example to compare the process list at different times )
@alanelston2330
@alanelston2330 2 жыл бұрын
3 of 10 I noticed for the first time, after seeing that you did it, that you can highlight a script row or even part of a script row, such as a CmdLet, and hit a small selection play button ( situated between the stop and play button in the ISE ) That is something useful that I can not so easily do in the MS Office VBA VB Editor. So that's an interesting feature. I guess this feature originates from, or is made easier to make available, since PowerShell originates in the cmd or CmdLets type stuff
@alanelston2330
@alanelston2330 2 жыл бұрын
4 of 10 I can use the same feature that I mentioned in the last reply, to look at what is in my variables, but I note that I will have needed to have run the script at least once to fill them. I note also that to get at what is going on in some variables in a function, I might need to do some other steps in the PowerShell first, like for example to get the objects you use to get the columns and headers row, I would need to do like PS C:\WINDOWS\system32> $Processes = Get-Process | Select Id,ProcessName,Handles,NPM,PM,WS,VM,CPU,Path PS C:\WINDOWS\system32> $ProcessProperties = $Processes[0].psObject.Properties PS C:\WINDOWS\system32> $ProcessProperties
@alanelston2330
@alanelston2330 2 жыл бұрын
5 of 10 I notice that comparing the output given by write-host for something, and what I get if I directly in the PowerShell window when I look at the same thing: - then I do get the same information, but often in a slightly different format. I suppose that might just be telling me that something is controlling what infomation is passed to me, and so in what form. That leads on nicely to my next reply...
@alanelston2330
@alanelston2330 2 жыл бұрын
6 of 10 ….One other extra feature of the ISE or PowerShell parallel window, that I don't have in the MS Office VB Editor, ( or VB Editor Debug Immediate Window ), is that I can write out an array, (or get something similar with multiple item information if I paste out an object) In the MS Office VB Editor, ( or VB Edit Debug Immediate Window ), I am limited to single values, (unless I take extra steps to set watches on objects or arrays) So that's where the ISE is a bit better than the VB Editor
@scottmcgrath315
@scottmcgrath315 3 жыл бұрын
Really helpful video thanks. Only thing I'd say is there is an important reason for functions to be at the top in a language like PowerShell and it's to make sure they're first in order of execution.
@alanelston2330
@alanelston2330 2 жыл бұрын
You're right. I think the function needs to have been passed at least once in order for it to be put into the memory of the current open PowerShell script window thing. He noticed that himself later and had already corrected hinself in his next video. ( In fact he pinned my reply about it in the next video, a few days ago) Alan
@max_larum
@max_larum 6 жыл бұрын
10/10 would watch again
@MKcLTM
@MKcLTM 7 жыл бұрын
thanks so much for these tutorials.. im struggling with powershell forms a little bit, this really helps me out. I would like one question though.. if i build GUI for helpdesk, how would you "hide" service account/password in the script. PS2EXE dont like WinForms, and PowerShell Studio is kinda pricey...
@SX86.ps1
@SX86.ps1 7 жыл бұрын
Thanks for your feedback! I used PS2EXE only a few times, and I didn't like the output of it. Every console message appeared on screen as a Message Box, and it didn't look like it was working exactly the same as the original PS1 script file. As for the service account and password, I am not sure that I understand exactly what you need help with? If you could clarify what is your end goal, I'd be glad to try and help you!
@MKcLTM
@MKcLTM 7 жыл бұрын
Thanks for your answer :) Im about to create a GUI application, for managing domain computers (create, delete, set ManagedBy..) The problem is to hide credentials within script (as the app will be used by many users, who dont have direct access to active directory). So, only one solution appears to me.. convert ps1 to executable. Which Sapien PowerShell Studio is capable of. Well, seems like i would have to go for it if i wanna create GUI apps for coleagues. I like the design of this app github.com/chair6/madness If i build something similar in my own, im struggling with listview form (how to set visible headers, columns dont create etc..). When i go through the script i posted, i can understand most of it, make modifications .. but when i try do the same in my own (listview form, listview selected item into multiple textbox fields..), i struggle. I didnt look at this tutorial deep enough (skipped most of the parts cause i was tired (2 A.M.), i will look into it again soon and hope ill find my answers how to deal with listforms :) Regards
@SX86.ps1
@SX86.ps1 7 жыл бұрын
+MKcLTM let me look into it for hiding credentials in the script, so they don't appear in plain text in it. The only solution I would think of is using convert to secure string, and use it this way, but that only works on one computer and windows user SID at a time. For the rest, creating list view and populating it, my example in this video pretty much tells you how to do it, unless you are a looking for a more advanced way of doing it.
@brianeckert1912
@brianeckert1912 6 жыл бұрын
Wonderful video. There is a simple reason for functions need to be at the top of the script: Powershell is not compiled. If functions were called before the script "saw" then, you'd get an error. Please consider adding more videos to the series. Perhaps a video on using SQL with PS? Again, many thanks! (One more thing. Would you consider exporting your color scheme? Merci.)
@alanelston2330
@alanelston2330 2 жыл бұрын
He noticed that hinself, and corrected himself in his next video. Interesting your comment that PowerShell is not complied. I am not a computer proffesional, but am learning PowerShell now, and the only other language I already know is MS Office VBA. I notice I have often to do extra things like running, in order to get as far as I do in things like debugging in PowerShell compared with VBA. VBA seems to do some things immediately as i write the coding which gives almost real time debugging. I wonder if the difference lies somewhere in the compiling difference between PowerShell and VBA? As far as the function issue goes, for example, I can put my functions anywhere in a normal code module in VBA and they are available immediately.
@sagorsengolder2374
@sagorsengolder2374 5 жыл бұрын
Excellent.. please keep up this good work.
@KaeRZed
@KaeRZed 2 жыл бұрын
Thanks for this tuto. Please post some new ones !! :-)
@JayeshPatel-sf9mz
@JayeshPatel-sf9mz 3 жыл бұрын
I need your help, how to design servers list in 5 different groups inside listview and process one by one and displaying progress and results will be displayed to respective servers next columns list
@wanjohisamuel8547
@wanjohisamuel8547 5 жыл бұрын
Easy to follow. Thanks man
@ghostman0234
@ghostman0234 3 жыл бұрын
Like it. Yes please make more. Thanks
@agatamarozas9860
@agatamarozas9860 7 жыл бұрын
I watch it and love it :) Please make more like this video :) I can see how it will really help me in m normal day of work. thank you :)
@SX86.ps1
@SX86.ps1 7 жыл бұрын
+Agata Marozas no problem! I will definitely make more.
@michaelcook7389
@michaelcook7389 4 жыл бұрын
Do you work with WPF?
@Coldmiser487
@Coldmiser487 7 жыл бұрын
the links in pastebin changed a lot of the " characters. You may want to update your description to let people know so they don't get errors
@SX86.ps1
@SX86.ps1 7 жыл бұрын
+Coldmiser487 I just tested the raw paste data from Pastebin, and it works perfectly. I'm not sure I understand the problem you are having, but I would love to help!
@Coldmiser487
@Coldmiser487 7 жыл бұрын
Sorry, must have been on my end. No problem here, I got it working.
@SX86.ps1
@SX86.ps1 7 жыл бұрын
+Coldmiser487 alright, perfect. Enjoy!
@chriscandillo8567
@chriscandillo8567 2 жыл бұрын
Great work. Do you have a link to your code?
@SX86.ps1
@SX86.ps1 2 жыл бұрын
Thanks! A link to the code can be found in the description.
@davidcordero9864
@davidcordero9864 4 жыл бұрын
I followed the tutorial and even copy pasted your final code and everything "looks" good but when I try to end a process it appears to only refresh the process list and not stop the processes I had selected???
@SX86.ps1
@SX86.ps1 4 жыл бұрын
Hmmm. Maybe the process you are trying to end is running under a different user? Try running PowerShell as admin and test again. Let me know if that works or not!
@davidcordero9864
@davidcordero9864 4 жыл бұрын
@@SX86.ps1 I tried it again after running Powershell as admin and it does the same thing. It appears to be doing something it even refreshes the list but no processes I had selected are ended.
@magnusblack8077
@magnusblack8077 4 жыл бұрын
@@davidcordero9864 You forgot to remove the -WhatIf in the EndProcesses function.
@jeewoof5617
@jeewoof5617 6 жыл бұрын
Love the video, it really helped me :))
@mahithyadavbudida2545
@mahithyadavbudida2545 6 жыл бұрын
Love these Vidoes, I have one doubt . How to copy the output which application display by using mouse.
@SX86.ps1
@SX86.ps1 6 жыл бұрын
Thank you! Do you mean, you want to copy the information of the currently selected process to the clipboard?
@mahithyadavbudida2545
@mahithyadavbudida2545 6 жыл бұрын
@@SX86.ps1 Yes. Just to copy output from Powershell App to some notepad.
@StMatX
@StMatX 5 жыл бұрын
I'm begginer in working with PS for AD. I'm trying to do something very similar with list of computers. What i'm doing wrong, i cannot find psObject. Or is this sompething what did you import? Thanks
@SX86.ps1
@SX86.ps1 5 жыл бұрын
Hi! Did you already import the active directory module?
@StMatX
@StMatX 5 жыл бұрын
​@@SX86.ps1 , i have install requestet RSAT. Funny thing is that it works with foreach loop, but problem remains with foraech-object. Maybe is realy problem with import modul.
@SX86.ps1
@SX86.ps1 5 жыл бұрын
Show me your code if you want. I'll have a look at it.
@StMatX
@StMatX 5 жыл бұрын
#My first PS test forma Import-Module ActiveDirectory #Load demanding assemblies [void][System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") $global:klicks = 0 $global:tmpPath = "CN=Computers,DC=Something,DC=eu" #Function Function GetAdComputers { $lstListOfComputers.items.Clear() $lstListOfComputers.Columns.Clear() $ADComputersCN = Get-ADComputer -Filter * -Searchbase $global:tmpPath -Properties * | Select name,operatingsystem,lastlogondate,ipv4address $PropertiesOfComputersAD = $ADComputersCN[0].psObject.Properties $ColumnNames = ($ADComputersCN[0].psObject.Properties).Name foreach($colName in $ColumnNames) { $lstListOfComputers.Columns.Add($colName) } #$PropertiesOfComputersAD | ForEach {$lstListOfComputers.Columns.Add("$($_name)")} #Loop true every object in array and add in to row Foreach ($ADRacunalnik in $ADComputersCN) { #create listitem $lstADComputers = New-Object System.Windows.Forms.ListViewItem($ADComputer.Name) $ADComputer.psObject.Properties | ForEach-Object { $rowname = $_.Name Write-Host $rowname $lstADComputers.SubItems.Add("$($ADComputer.$rowname)") | Out-Null } $lstListOfComputers.items.Add($lstListOfComputers) | Out-Null } $lstListOfComputers.AutoResizeColumns("Headsize") } #New form - MUI $Form_Hej = New-Object System.Windows.Forms.Form $Form_Hej.Text = "Hej Marek!" $Form_Hej.Size = New-Object System.Drawing.Size(832,528) $Form_Hej.FormBorderStyle = "FixedDialog" $Form_Hej.TopMost = $false $Form_Hej.MaximizeBox = $true $Form_Hej.MinimizeBox = $true $Form_Hej.ControlBox = $true $Form_Hej.StartPosition = "CenterScreen" $Form_Hej.Font = "Sagoe UI" #Add-create label on form $label_Hej = New-Object System.Windows.Forms.Label $label_Hej.Location = New-Object System.Drawing.Size(8,8) $label_Hej.Size = New-Object System.Drawing.Size(240,32) $label_Hej.TextAlign = "MiddleCenter" $label_hej.Text = "List of the computers in DC=Something.eu" $Form_Hej.Controls.Add($label_Hej) #Add Listview $lstListOfComputers = New-Object System.Windows.Forms.ListView $lstListOfComputers.Location = New-Object System.Drawing.Size(8,40) $lstListOfComputers.Size = New-Object System.Drawing.Size(800,402) $lstListOfComputers.View = "Details" $lstListOfComputers.FullRowSelect = $true $lstListOfComputers.MultiSelect = $true $lstListOfComputers.Sorting = "None" $lstListOfComputers.AllowColumnReorder = $true $lstListOfComputers.GridLines = $true $Form_Hej.Controls.Add($lstListOfComputers) #Add button refresh $btnGumb = New-Object System.Windows.Forms.Button $btnGumb.Location = New-Object System.Drawing.Size(8,450) $btnGumb.Size = New-Object System.Drawing.Size(240,32) $btnGumb.TextAlign = "MiddleCenter" $btnGumb.Text = "Refresh" $btnGumb.Add_Click( { GetComputers # $global:klicks++ #$date = Get-Date # $btnButton.Text = "Click in time ($date): "+$global:klicks # Start-Process calc.exe }) $Form_Hej.Controls.Add($btnButton) #Show Form $Form_Hej.Add_Shown({$Form_Hej.Activate();GetAdComputers}) [void] $Form_Hej.ShowDialog()
@StMatX
@StMatX 5 жыл бұрын
And always i recieve message: PS C:\WINDOWS\system32> D:\AD\tmp\HejForm.ps1 cmdlet ForEach-Object at command pipeline position 1 Supply values for the following parameters: Process[0]: It is happening at row 40 in code - $ADComputer.psObject.Properties | ForEach-Object { ....
@kohen2304
@kohen2304 6 жыл бұрын
I have watched this video about 30 times and I still cannot seem to get my columns populated.. all I get is the ID# in the very first column help?
@SX86.ps1
@SX86.ps1 6 жыл бұрын
If you send me a link to your code, I can have a look at it and see where it goes wrong. Let me know! If not, you can compare with the Pastebin link in the description.
@kohen2304
@kohen2304 6 жыл бұрын
I compared it to the pastebin code and found my error, thank you!!
@darkwraithcovenantindustries
@darkwraithcovenantindustries 5 жыл бұрын
Why did you use -bor instead of -or?
@SX86.ps1
@SX86.ps1 5 жыл бұрын
Excellent question...which I do not have the answer for. I found that part of the code somewhere on the internet and adapted it to my code. I haven't tried using "or" instead of "bor" to see if it would make a difference.
@sagorsengolder2374
@sagorsengolder2374 5 жыл бұрын
Does there any way to select processes through checkbox?
@SX86.ps1
@SX86.ps1 5 жыл бұрын
Yes, you could add checkboxes to each item in the list, and go through the checked items when clicking "end process".
@sagorsengolder2374
@sagorsengolder2374 5 жыл бұрын
Thank you so much.
@inshortbysuman
@inshortbysuman 4 жыл бұрын
Loved it .... :)
@adnan-khan
@adnan-khan 5 жыл бұрын
Functions are at the top as when the script it processed by the interpreter it looks at it from top line to bottom and holds the function in memory. How else would you call a function that isn't read yet? lol
@SX86.ps1
@SX86.ps1 5 жыл бұрын
Thanks for that! I didn't know at the time, all I knew is that it didn't work if they weren't at the beginning!
@ankushsethi6192
@ankushsethi6192 5 жыл бұрын
Hi I am learning Powershell Getprocess Function you used including List view that was awesome Can you provide any ebook or PDF which explains these in details
@SX86.ps1
@SX86.ps1 5 жыл бұрын
Hi! Most of what I learned was directly from Microsoft's documentation. docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-process?view=powershell-6 Same goes for all the windows controls used in my forms!
@EvansCon40
@EvansCon40 6 жыл бұрын
$listview_Processes.Add_ColumnClick({SortListView $_.Column}) SortListView : The term 'SortListView' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. Looks like a missing function?
@SX86.ps1
@SX86.ps1 6 жыл бұрын
SortListView is a function that you have to put at the beginning of the script.
@EvansCon40
@EvansCon40 6 жыл бұрын
Function SortListView{ param([parameter(Position=0)][UInt32]$Column) # determine how to sort $Numeric = $true # if the user clicked the same column that was clicked last time, reverse its sort order. otherwise, reset for normal ascending sort If($Script:LastColumnClicked -eq $Column){ $Script:LastColumnAscending = -not $Script:LastColumnAscending } Else{ $Script:LastColumnAscending = $true } $Script:LastColumnClicked = $Column # three-dimensional array; column 1 indexes the other columns, column 2 is the value to be sorted on, and column 3 is the System.Windows.Forms.ListViewItem object $ListItems = @(@(@())) Foreach($ListItem in $listview_Processes.Items){ # if all items are numeric, can use a numeric sort # nothing can set this back to true, so don't process unnecessarily If($Numeric -ne $false){ Try{ $Test = [Double]$ListItem.SubItems[[int]$Column].Text } Catch{ $Numeric = $false } } $ListItems += ,@($ListItem.SubItems[[int]$Column].Text,$ListItem) } # create the expression that will be evaluated for sorting $EvalExpression = { If($Numeric){ return [Double]$_[0] } Else{ return [String]$_[0] } } # all information is gathered; perform the sort $ListItems = $ListItems | Sort-Object -Property @{Expression=$EvalExpression; Ascending=$Script:LastColumnAscending} ## the list is sorted; display it in the listview $listview_Processes.BeginUpdate() $listview_Processes.Items.Clear() Foreach($ListItem in $ListItems){ $listview_Processes.Items.Add($ListItem[1]) } $listview_Processes.EndUpdate() }
@ClevergunsYT
@ClevergunsYT 5 жыл бұрын
please make another video.
@alanelston2330
@alanelston2330 2 жыл бұрын
1 of 5 The way things were done in the function GetProcesses was very good for learning purposes, because some interesting complicated things were introduced , explained and used. But as I have just been learning further PowerShell, I see now that things could be done much simpler For example…
@alanelston2330
@alanelston2330 2 жыл бұрын
2 of 5 …Initially we started getting our $Processes knowing the headings, Id,ProcessName,Handles,NPM,PM,WS,VM,CPU,Path So we knew those already.
@alanelston2330
@alanelston2330 2 жыл бұрын
3 of 5 _ so to get the ListView columns we just need ForEach ($Hdr in @("Id", "ProcessName", "Handles", "NPM", "PM", "WS", "VM", "CPU", "Path")){$listview_Processes.Columns.Add($Hdr)} and ….
@alanelston2330
@alanelston2330 2 жыл бұрын
4 of 5 … we can simplify the loop which gets the SubItems to something like ForEach ($Hdr in @( "ProcessName", "Handles", "NPM", "PM", "WS", "VM", "CPU", "Path")){$ProcessListViewItem.SubItems.Add("$($Process.$Hdr)")}
@alanelston2330
@alanelston2330 2 жыл бұрын
5 of 5 That was just an observation, that’s all. Originally I could not see the Wood for the Trees, and missed that. I made those changes and considerably simplified the script and it still woks (KZbin wont let me give a link to my shared copy unfortunately :( )
@alanelston2330
@alanelston2330 2 жыл бұрын
Let me see if KZbin will let me post the simplified function Function GetProcesses{ $listview_Processes.Items.Clear() $listview_Processes.Columns.Clear() $Processes = Get-Process | Select-Object Id,ProcessName,Handles,NPM,PM,WS,VM,CPU,Path ForEach ($Hdr in @("Id", "ProcessName", "Handles", "NPM", "PM", "WS", "VM", "CPU", "Path")){$listview_Processes.Columns.Add($Hdr)} ForEach ($Process in $Processes){ $ProcessListViewItem = New-Object System.Windows.Forms.ListViewItem($Process.Id) ForEach ($Hdr in @( "ProcessName", "Handles", "NPM", "PM", "WS", "VM", "CPU", "Path")){$ProcessListViewItem.SubItems.Add("$($Process.$Hdr)")} $listview_Processes.Items.Add($ProcessListViewItem) } $listview_Processes.AutoResizeColumns("HeaderSize") }
@TheAmazeer
@TheAmazeer 4 жыл бұрын
1 line of code : get-process | out-grid view 😎😎😎
@SX86.ps1
@SX86.ps1 4 жыл бұрын
But can you end the process?! 😱 Ahah!
@TheAmazeer
@TheAmazeer 4 жыл бұрын
@@SX86.ps1 yes you can just pipe selected item to stop process
@SX86.ps1
@SX86.ps1 4 жыл бұрын
Alright, you got me! The point of that video was to take a list (could be a CSV) and output it to a customizable windows form. 😊
@TheAmazeer
@TheAmazeer 4 жыл бұрын
@@SX86.ps1 je suis français mon ami : Get-Process | Out-GridView -PassThru | Stop-Process mais tes vidéos sont très bien tkt pas
@SX86.ps1
@SX86.ps1 4 жыл бұрын
Merci mec! J'ai manqué d'inspiration pour continuer!
PowerShell Windows Forms Tutorial 3 : SHA1 Hash Checker
26:34
SX86 - PowerShell.toGUI
Рет қаралды 8 М.
PowerShell Windows Forms Tutorial 1 : Hello World
21:01
SX86 - PowerShell.toGUI
Рет қаралды 57 М.
1 сквиш тебе или 2 другому? 😌 #шортс #виола
00:36
黑的奸计得逞 #古风
00:24
Black and white double fury
Рет қаралды 25 МЛН
Life hack 😂 Watermelon magic box! #shorts by Leisi Crazy
00:17
Leisi Crazy
Рет қаралды 80 МЛН
Сюрприз для Златы на день рождения
00:10
Victoria Portfolio
Рет қаралды 2,4 МЛН
PowerShell | Designing Windows form Part 1
42:57
PowerShell Experiments
Рет қаралды 10 М.
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 72 М.
Building a GUI based Powershell script using FREE Tools - Method 2
24:09
I reverse engineered Next to find what they are hiding
29:48
Theo - t3․gg
Рет қаралды 3,2 М.
PowerShell Arrays Introduction
19:20
Shane Young
Рет қаралды 54 М.
The Magic Of ARM w/ Casey Muratori
1:25:01
ThePrimeTime
Рет қаралды 92 М.
How To Create A GUI For Your PowerShell Script With WinForms
8:29
TechSnips by ATA Learning
Рет қаралды 47 М.
The Tragedy of systemd
47:18
linux.conf.au
Рет қаралды 1,1 МЛН
1 сквиш тебе или 2 другому? 😌 #шортс #виола
00:36