![Gitter](https://badges.gitter.im/Join Chat.svg)
AppDomainPoshRunner, or ADPS for short, is a library and executable for running PowerShell scripts in a separate appdomain. Its most common form is the standalone executable poshrunner.exe.
Included in the zip file is AppDomainPoshRunner.SecondAppDomain.ps1, so you can run these examples by unzipping the files, opening a command prompt, and cd-ing to the directory you unzipped the files to
REM run AppDomainPoshRunner.SecondAppDomain.ps1 and write output to the console
poshrunner -f AppDomainPoshRunner.SecondAppDomain.ps1
REM run AppDomainPoshRunner.SecondAppDomain.ps1 and write output to poshrunner.log
poshrunner -f AppDomainPoshRunner.SecondAppDomain.ps1 --log4netConfigType=File
Here are some compelling features:
- A script can have its own app.config separate from powershell.exe.config
- All output is written to a custom implementation of log4Net.ILog. This means:
- You can send script output to a log file instead of (or in addition to) the console.
- You can have
Write-Error
write a message to the event log. - You can send script output to mongodb with Log4Mongo
- Much much more
The recommended way to install poshrunner.exe is the chocolatey package.
Since GitHub no longer allows downloads, I have created a sourceforge.net project for PoshRunner. Here is a direct link to the latest download.
ADPR is a little rough around the edges, but quite useable. Because ADPR implements PSHost, the following cmdlets will run:
Write-Verbose 'Verbose Message';
Write-Debug 'Debug Message';
Write-Host 'Host Message';
Write-Host -ForegroundColor green "Green Text"
Write-Warning 'Warning Message';
Write-Error 'Error Message'