Call me...


Hello
T he atheist rejects the claim that there is a
supernatural entity or force that interacts with existence...
Because it is a claim without basis.

Atheism makes no claims whatsoever.
Atheism asserts nothing.
Atheism IS NOT an act or an action
IT IS a position
 It has no objective.
Comparatively / Conversely:
Anti-theism IS an act or an action
 It IS NOT a position
 It has an objective.
Not all ATHEISTS are ANTI-THEIST.
All ANTI-THEISTS are ATHEIST.

Wednesday, February 26, 2020

Add PID to Powershell Window - To quickly fix lock ups.


This should come in handy…
If you are like me, and have a few different ISE windows open at any given time…
And one of them locks-up on you

Knowing which one to kill from the task manager, is almost impossible… 
But if you know its PID…
Get-Process -Id 15868 | Stop-Process -Force

You can kill the frozen window, and when you re-open ISE, its session saving feature will restore it.

 The work is done here:
(Get-Process -ID $PID).Id

Adding the PID to the title of the PowerShell window is done in the Profile…
  • Profile.ps1
  • Microsoft.PowerShell_profile.ps1
  • Microsoft.PowerShellISE_profile.ps1
Here is an example:
function Test-IsAdmin {([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")}
if (!(Test-IsAdmin)){$Host.UI.RawUI.WindowTitle = "STANDARD Emetic Gyroscopic Discombobulator - PLEBE Edition - (PID - $((Get-Process -ID $PID).Id))"}
else {$Host.UI.RawUI.WindowTitle = "DELUXE Emetic Gyroscopic Discombobulator - God Mode (PID - $((Get-Process -ID $PID).Id))"}

That whole Test-IsAdmin is not needed – I just have my window tricked out (I’ve even changed the icon for the Admin sessions).

The only thing needed would be something like this:
Host.UI.RawUI.WindowTitle = "PowerShell ISE - (PID - $((Get-Process -ID $PID).Id))"

No comments:

Post a Comment