Return Of The PSGhost

I have just released version 2.0 of PSGhost. Internally PSGhost has many changes, but its behavior is otherwise not changed. The biggest change is that commands are no longer invoked within PSGhost. It interprets its command line arguments as being a command for Powershell.exe. PSGhost encodes the command and hands it over to Powershell.exe, and prevents the console window from appearing.

A few benefits of this is that the binary is much smaller, down from 16KB to 5KB. Also, the memory requirement has been significantly reduced. I’m not sure why, but, when loading System.Windows.Forms.dll and showing a simple message box, version 1 of psghost.exe used about two to four times as much memory as powershell.exe. Another thing is that since commands are invoked within a hidden powershell.exe process any console applications called by those commands are also hidden. Version 1 was not able to hide the console windows of console applications used by psghost scripts. The one drawback is that since powershell.exe is used as the actual host then there is no direct way to know whether the console window can be used for user input. Any command going into PSGhost must not attempt to use either the console or the powershell host object to get user input, but must know beforehand that the only way to get user input is to create a GUI using WinForms or WPF.

There may still be some room for improvement in PSGhost. Version 2 doesn’t use the same profile that was used by version 1. PSGhost definitely has the potential to perform some pre processing on the command to do things like use a separate profile. Otherwise I see version 2.0 as being the completion of the project. The original objectives have be completed.

PSGhost can be downloaded from SkyDrive or from my website.


~ by lunaticexperimentalist on December 7, 2008.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: