15

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?

2
  • What a neat idea! Please consider sharing the script on PoshCode.org (or elsewhere) if your employer is cool like that. Commented Sep 21, 2012 at 17:49
  • Your image URL doesn't start with https://. Please edit your question to upload the image in Imgur. Commented May 17, 2022 at 2:26

1 Answer 1

30

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

[System.Windows.Forms.Application]::EnableVisualStyles();
Sign up to request clarification or add additional context in comments.

4 Comments

I actually love you! Cheers Dude, this was sending me up the wall!
NP. BTW if this answers your question, you might want to mark it as answered. :-)
+1 although it doesn't answer the "..., Why?", See also: Why does the icon and buttons on the popup look different sometimes?
it all makes sense now :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.