14

I have written a script which is basically a small wysiwyg signature generator for Outlook. We want our signatures to be in corporate colours, and semi-standardised - hence the requirement for this.

I did the development work in Powershell ISE and all looked good. However, when I run the script just using powershell (as the users will) it looks totally different:

Powershell vs Powershell ISE http://www.freeimagehosting.net/uploads/1d6e6c5c6f.png

The top one was generated in ISE, and looks as I want it. The bottom one was run from powershell directly and seems to have visually regressed five years!

How can I get the script to look as snazzy in Powershell as it does in Powershell ISE?

Arnav Thorat
  • 3,078
  • 3
  • 8
  • 33
Ben
  • 4,281
  • 8
  • 62
  • 103
  • What a neat idea! Please consider sharing the script on PoshCode.org (or elsewhere) if your employer is cool like that. – halr9000 Sep 21 '12 at 17:49
  • Your image URL doesn't start with `https://`. Please edit your question to upload the image in Imgur. – Arnav Thorat May 17 '22 at 02:26

1 Answers1

27

Add the following line in your script before you show the form:

[System.Windows.Forms.Application]::EnableVisualStyles();
Keith Hill
  • 194,368
  • 42
  • 353
  • 369
  • I actually love you! Cheers Dude, this was sending me up the wall! – Ben Jul 29 '10 at 08:46
  • NP. BTW if this answers your question, you might want to mark it as answered. :-) – Keith Hill Jul 29 '10 at 15:01
  • 2
    `+1` although it doesn't answer the "***..., Why?***", See also: [Why does the icon and buttons on the popup look different sometimes?](https://stackoverflow.com/q/72245690/1701026) – iRon May 15 '22 at 16:08