Image & Colors

Brand your AnyBox with an image. The -Image parameter accepts either:

  1. The path to an accessible image file (.png, .jpg, etc.)
  2. The base64 encoded string representing an image.

Additionally, -FontFamily, -FontColor, and -BackgroundColor allow you to

[hashtable]$font = @{ FontFamily = 'Courier New'; FontColor = 'CornflowerBlue'; FontSize=20 }

Show-AnyBox @font -WindowStyle 'None' -Message 'Hello World', 'Are you ready?' -Buttons 'Yes' `
  -BackgroundColor 'Black' -Image '.\banner.png'

By using a base64 string representing the image, you can save and reuse the string without worrying about whether or not the image file is accessible. For convenience, the AnyBox module includes a function ConvertTo-Base64 which accepts the path to an image file as input, and returns the base64 representation of it.

Window Style

Since AnyBox uses the default Windows modal, all of the System.Window.WindowStyle options are available:

  • None

  • Single Border Window

  • 3D Border Window


  • Tool Window

Similarly, all System.Windows.ResizeMode options are available (detailed here). However, because the AnyBox works by using a StackPanel to stack the controls atop one another, no vertical resizing is possible; only horizontal resizing. For this reason, it may be best to stick with NoResize or CanMinimize, since maximizing the window will look odd. Also, consider using the ToolWindow style, which omits all but the ‘exit’ button.

EDIT: the above no longer applies since v0.2; a window can now be fully maximized.

A few notes on -ResizeMode… Maximizing and Minimizing is considered “resizing”. Thus:

  • “NoResize” will hide the minimize and maximize buttons, and will not allow users to resize the window.
  • “CanMinimize” will show the minimize button, but disable the maximize button and will not allow users to resize the window.
  • “CanResize” and “CanResizeWithGrip” will show the minimize and maximize buttons, and allow users to resize the window.


Lastly, the AnyBox has a timeout feature that will close the window after the specified number of seconds. It is configured using the -Timeout and, when specified, the AnyBox output will include a key named TimedOut to indicate if the timeout was reached.

The switch parameter -Countdown will show a countdown in the AnyBox.

Name         Value
----          -----
I feel fine   False
TimedOut      True

Scripting Options

Users can provide their own options and more via the use of the -PrepScript parameter. Pass a script block here, and it will be ran before the window is shown. The advantage is that all of the form variables, stored in the variable $_, are accessible. The options with -PrepScript are endless, so I’ll just provide this example, which exports all variables to a grid view prior to showing the window:

Show-AnyBox -Message 'Testing' -PrepScript {
  Get-Variable | Out-GridView -Title 'AnyBox Vars'