{"id":596,"date":"2008-08-12T11:00:52","date_gmt":"2008-08-12T19:00:52","guid":{"rendered":"http:\/\/www.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/"},"modified":"2008-08-12T11:12:21","modified_gmt":"2008-08-12T19:12:21","slug":"powershell-msgbox","status":"publish","type":"post","link":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/","title":{"rendered":"PowerShell MsgBox"},"content":{"rendered":"<p>If you came from the VBScript world you may be missing a few old friends in PowerShell. Because Powershell is a management console, it lacks a GUI unless you create one using Windows forms. Things will change a bit in PowerShell v2.0 but for now let&#8217;s stick with what we have.\u00a0 If you really need a message box, ala VBScript, then simply call it from PowerShell.\u00a0 All you need to do is use the [microsoft.visualbasic.interaction] class and the MsgBox method.<\/p>\n<p>Before you can use it, you will likely need to load the .NET assembly:<\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\">PS C:\\&gt; [reflection.assembly]::loadwithpartialname(&#8220;microsoft.visualbasic&#8221;) | Out-Null <\/span><\/p>\n<p>Once loaded you can call a message box as easy as this:<a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2008\/08\/basicmsgbox.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2008\/08\/basicmsgbox-thumb.png\" border=\"0\" alt=\"basicmsgbox\" width=\"237\" height=\"156\" align=\"right\" \/><\/a><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\">PS C:\\&gt; [microsoft.visualbasic.interaction]::MsgBox(&#8220;Hello everyone&#8221;)<br \/>\nOk<br \/>\nPS C:\\&gt;<\/span><\/p>\n<p>As you can see it is a barebones message box.<\/p>\n<p>The MsgBox method supports all the things you remember from VBScript like different buttons, a title and icons. Valid button choices include: OkOnly, OkCancel, AbortRetryIgnore, YesNoCancel, YesNo, RetryCancel. There are a few other options but these are the ones you are most likely to use. Valid icons include: Critical, Question, Exclamation, Information.<\/p>\n<p>Here is a function to create a message box and sample code that demonstrates it.<\/p>\n<div style=\"border: 1px solid gray; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; max-height: 200px; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\">\n<div style=\"border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\">\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;\"><span style=\"color: #606060;\">   1:<\/span> Function Show-Msgbox {<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\"><span style=\"color: #606060;\">   2:<\/span>   Param([string]$message=$(Throw <span style=\"color: #006080;\">\"You must specify a message\"<\/span>),<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;\"><span style=\"color: #606060;\">   3:<\/span>       [string]$button=<span style=\"color: #006080;\">\"okonly\"<\/span>,<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\"><span style=\"color: #606060;\">   4:<\/span>       [string]$icon=<span style=\"color: #006080;\">\"information\"<\/span>,<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;\"><span style=\"color: #606060;\">   5:<\/span>       [string]$title=<span style=\"color: #006080;\">\"Message Box\"<\/span><\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\"><span style=\"color: #606060;\">   6:<\/span>      )<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;\"><span style=\"color: #606060;\">   7:<\/span><\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\"><span style=\"color: #606060;\">   8:<\/span> <span style=\"color: #008000;\"># Buttons: OkOnly, OkCancel, AbortRetryIgnore, YesNoCancel, YesNo, RetryCancel<\/span><\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;\"><span style=\"color: #606060;\">   9:<\/span> <span style=\"color: #008000;\"># Icons: Critical, Question, Exclamation, Information<\/span><\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\"><span style=\"color: #606060;\">  10:<\/span><\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;\"><span style=\"color: #606060;\">  11:<\/span>   [reflection.assembly]::loadwithpartialname(<span style=\"color: #006080;\">\"microsoft.visualbasic\"<\/span>) | Out-Null<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\"><span style=\"color: #606060;\">  12:<\/span><\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;\"><span style=\"color: #606060;\">  13:<\/span>   [microsoft.visualbasic.interaction]::Msgbox($message,<span style=\"color: #006080;\">\"$button,$icon\"<\/span>,$title)<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\"><span style=\"color: #606060;\">  14:<\/span><\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;\"><span style=\"color: #606060;\">  15:<\/span>  }<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\"><span style=\"color: #606060;\">  16:<\/span><\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;\"><span style=\"color: #606060;\">  17:<\/span> $rc=Show-Msgbox -message <span style=\"color: #006080;\">\"Do you know what you're doing?\"<\/span> `<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\"><span style=\"color: #606060;\">  18:<\/span> -icon <span style=\"color: #006080;\">\"exclamation\"<\/span> -button <span style=\"color: #006080;\">\"YesNoCancel\"<\/span> -title <span style=\"color: #006080;\">\"Hey $env:username!!\"<\/span><\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;\"><span style=\"color: #606060;\">  19:<\/span><\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\"><span style=\"color: #606060;\">  20:<\/span> Switch ($rc) {<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;\"><span style=\"color: #606060;\">  21:<\/span>  <span style=\"color: #006080;\">\"Yes\"<\/span> {<span style=\"color: #006080;\">\"I hope your resume is up to date.\"<\/span>}<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\"><span style=\"color: #606060;\">  22:<\/span>  <span style=\"color: #006080;\">\"No\"<\/span> {<span style=\"color: #006080;\">\"Wise move.\"<\/span>}<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;\"><span style=\"color: #606060;\">  23:<\/span>  <span style=\"color: #006080;\">\"cancel\"<\/span> {<span style=\"color: #006080;\">\"When in doubt, punt.\"<\/span>}<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: #f4f4f4;\"><span style=\"color: #606060;\">  24:<\/span> }<\/pre>\n<pre style=\"border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; line-height: 12pt; font-family: consolas,'Courier New',courier,monospace; background-color: white;\"><span style=\"color: #606060;\">  25:<\/span><\/pre>\n<\/div>\n<\/div>\n<p>If you execute this you should expect a result like this:<\/p>\n<p><a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2008\/08\/pshmsgbox.png\"><img loading=\"lazy\" decoding=\"async\" style=\"border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px\" src=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2008\/08\/pshmsgbox-thumb.png\" border=\"0\" alt=\"pshmsgbox\" width=\"353\" height=\"173\" \/><\/a><\/p>\n<p>The MsgBox method will write the name of the clicked button to the pipeline. This allows me to save the MsgBox results to a variable and use a Switch construct to take action based on the value:<\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\">$rc=Show-Msgbox -message &#8220;Do you know what you&#8217;re doing?&#8221; `<br \/>\n-icon &#8220;exclamation&#8221; -button &#8220;YesNoCancel&#8221; -title &#8220;Hey $env:username!!&#8221; <\/span><\/p>\n<p><span style=\"font-family: Consolas; color: #0000ff;\">Switch ($rc) {<br \/>\n&#8220;Yes&#8221; {&#8220;I hope your resume is up to date.&#8221;}<br \/>\n&#8220;No&#8221; {&#8220;Wise move.&#8221;}<br \/>\n&#8220;cancel&#8221; {&#8220;When in doubt, punt.&#8221;}<br \/>\n}<\/span><\/p>\n<p>You&#8217;re probably thinking, &#8220;This is great but where&#8217;s my Inputbox?&#8221; Don&#8217;t worry.\u00a0 It&#8217;s coming assuming you don&#8217;t figure it out on your own.<\/p>\n<div id=\"scid:fb3a1972-4489-4e52-abe7-25a00bb07fdf:6774b1d5-a087-49e9-b9e6-d10f4156e204\" class=\"wlWriterSmartContent\" style=\"padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px\">\n<p>You can download this sample function and script <a href=\"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2008\/08\/show-msgbox.txt\" target=\"_blank\">here<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>if you came from the VBScript world you may be missing a few old friends in PowerShell. Because Powershell is a management console, it lacks a GUI unless you create one using Windows forms. Things will change a bit in PowerShell v2.0 but for now let&#8217;s stick with what we have.  If you really need a message box, ala VBScript, then simply call it from PowerShell.  All you need to do is use the [microsoft.visualbasic.interaction] class and the MsgBox method.<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[24,25],"tags":[198,268,28,269,996],"class_list":["post-596","post","type-post","status-publish","format-standard","hentry","category-vbscript","category-windows-powershell","tag-function","tag-msgbox","tag-powershell","tag-switch","tag-vbscript"],"aioseo_notices":[],"aioseo_head":"\n\t\t<!-- All in One SEO 5.0.1 - aioseo.com -->\n\t<meta name=\"description\" content=\"if you came from the VBScript world you may be missing a few old friends in PowerShell. Because Powershell is a management console, it lacks a GUI unless you create one using Windows forms. Things will change a bit in PowerShell v2.0 but for now let&#039;s stick with what we have. If you really need a message box, ala VBScript, then simply call it from PowerShell. All you need to do is use the [microsoft.visualbasic.interaction] class and the MsgBox method.\" \/>\n\t<meta name=\"robots\" content=\"max-image-preview:large\" \/>\n\t<meta name=\"author\" content=\"Jeffery Hicks\"\/>\n\t<link rel=\"canonical\" href=\"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/\" \/>\n\t<meta name=\"generator\" content=\"All in One SEO (AIOSEO) 5.0.1\" \/>\n\t\t<meta property=\"og:locale\" content=\"en_US\" \/>\n\t\t<meta property=\"og:site_name\" content=\"DEV SAPIEN Blog - Tools for IT Success\" \/>\n\t\t<meta property=\"og:type\" content=\"article\" \/>\n\t\t<meta property=\"og:title\" content=\"PowerShell MsgBox - DEV SAPIEN Blog\" \/>\n\t\t<meta property=\"og:description\" content=\"if you came from the VBScript world you may be missing a few old friends in PowerShell. Because Powershell is a management console, it lacks a GUI unless you create one using Windows forms. Things will change a bit in PowerShell v2.0 but for now let&#039;s stick with what we have. If you really need a message box, ala VBScript, then simply call it from PowerShell. All you need to do is use the [microsoft.visualbasic.interaction] class and the MsgBox method.\" \/>\n\t\t<meta property=\"og:url\" content=\"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/\" \/>\n\t\t<meta property=\"article:published_time\" content=\"2008-08-12T19:00:52+00:00\" \/>\n\t\t<meta property=\"article:modified_time\" content=\"2008-08-12T19:12:21+00:00\" \/>\n\t\t<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n\t\t<meta name=\"twitter:title\" content=\"PowerShell MsgBox - DEV SAPIEN Blog\" \/>\n\t\t<meta name=\"twitter:description\" content=\"if you came from the VBScript world you may be missing a few old friends in PowerShell. Because Powershell is a management console, it lacks a GUI unless you create one using Windows forms. Things will change a bit in PowerShell v2.0 but for now let&#039;s stick with what we have. If you really need a message box, ala VBScript, then simply call it from PowerShell. All you need to do is use the [microsoft.visualbasic.interaction] class and the MsgBox method.\" \/>\n\t\t<script type=\"application\/ld+json\" class=\"aioseo-schema\">\n\t\t\t{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"BlogPosting\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2008\\\/08\\\/12\\\/powershell-msgbox\\\/#blogposting\",\"name\":\"PowerShell MsgBox - DEV SAPIEN Blog\",\"headline\":\"PowerShell MsgBox\",\"author\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/jeffery-hicks\\\/#author\"},\"publisher\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\"},\"image\":{\"@type\":\"ImageObject\",\"url\":\"http:\\\/\\\/www.sapien.com\\\/blog\\\/wp-content\\\/uploads\\\/2008\\\/08\\\/basicmsgbox-thumb.png\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2008\\\/08\\\/12\\\/powershell-msgbox\\\/#articleImage\"},\"datePublished\":\"2008-08-12T11:00:52-07:00\",\"dateModified\":\"2008-08-12T11:12:21-07:00\",\"inLanguage\":\"en-US\",\"commentCount\":2,\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2008\\\/08\\\/12\\\/powershell-msgbox\\\/#webpage\"},\"isPartOf\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2008\\\/08\\\/12\\\/powershell-msgbox\\\/#webpage\"},\"articleSection\":\"VBScript, Windows PowerShell, function, MsgBox, powershell, Switch, VBScript\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2008\\\/08\\\/12\\\/powershell-msgbox\\\/#breadcrumblist\",\"itemListElement\":[{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog#listItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/vbscript\\\/#listItem\",\"name\":\"VBScript\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/vbscript\\\/#listItem\",\"position\":2,\"name\":\"VBScript\",\"item\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/vbscript\\\/\",\"nextItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2008\\\/08\\\/12\\\/powershell-msgbox\\\/#listItem\",\"name\":\"PowerShell MsgBox\"},\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog#listItem\",\"name\":\"Home\"}},{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2008\\\/08\\\/12\\\/powershell-msgbox\\\/#listItem\",\"position\":3,\"name\":\"PowerShell MsgBox\",\"previousItem\":{\"@type\":\"ListItem\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/topics\\\/vbscript\\\/#listItem\",\"name\":\"VBScript\"}}]},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\",\"name\":\"DEV SAPIEN Blog\",\"description\":\"Tools for IT Success\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/jeffery-hicks\\\/#author\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/jeffery-hicks\\\/\",\"name\":\"Jeffery Hicks\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2008\\\/08\\\/12\\\/powershell-msgbox\\\/#webpage\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2008\\\/08\\\/12\\\/powershell-msgbox\\\/\",\"name\":\"PowerShell MsgBox - DEV SAPIEN Blog\",\"description\":\"if you came from the VBScript world you may be missing a few old friends in PowerShell. Because Powershell is a management console, it lacks a GUI unless you create one using Windows forms. Things will change a bit in PowerShell v2.0 but for now let's stick with what we have. If you really need a message box, ala VBScript, then simply call it from PowerShell. All you need to do is use the [microsoft.visualbasic.interaction] class and the MsgBox method.\",\"inLanguage\":\"en-US\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#website\"},\"breadcrumb\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/2008\\\/08\\\/12\\\/powershell-msgbox\\\/#breadcrumblist\"},\"author\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/jeffery-hicks\\\/#author\"},\"creator\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/author\\\/jeffery-hicks\\\/#author\"},\"datePublished\":\"2008-08-12T11:00:52-07:00\",\"dateModified\":\"2008-08-12T11:12:21-07:00\"},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/\",\"name\":\"DEV SAPIEN Blog\",\"description\":\"Tools for IT Success\",\"inLanguage\":\"en-US\",\"publisher\":{\"@id\":\"https:\\\/\\\/dev.sapien.com\\\/blog\\\/#organization\"}}]}\n\t\t<\/script>\n\t\t<!-- All in One SEO -->\n\n","aioseo_head_json":{"title":"PowerShell MsgBox - DEV SAPIEN Blog","description":"if you came from the VBScript world you may be missing a few old friends in PowerShell. Because Powershell is a management console, it lacks a GUI unless you create one using Windows forms. Things will change a bit in PowerShell v2.0 but for now let's stick with what we have. If you really need a message box, ala VBScript, then simply call it from PowerShell. All you need to do is use the [microsoft.visualbasic.interaction] class and the MsgBox method.","canonical_url":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/","robots":"max-image-preview:large","keywords":"","webmasterTools":{"miscellaneous":""},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"BlogPosting","@id":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/#blogposting","name":"PowerShell MsgBox - DEV SAPIEN Blog","headline":"PowerShell MsgBox","author":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/jeffery-hicks\/#author"},"publisher":{"@id":"https:\/\/dev.sapien.com\/blog\/#organization"},"image":{"@type":"ImageObject","url":"http:\/\/www.sapien.com\/blog\/wp-content\/uploads\/2008\/08\/basicmsgbox-thumb.png","@id":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/#articleImage"},"datePublished":"2008-08-12T11:00:52-07:00","dateModified":"2008-08-12T11:12:21-07:00","inLanguage":"en-US","commentCount":2,"mainEntityOfPage":{"@id":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/#webpage"},"isPartOf":{"@id":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/#webpage"},"articleSection":"VBScript, Windows PowerShell, function, MsgBox, powershell, Switch, VBScript"},{"@type":"BreadcrumbList","@id":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/#breadcrumblist","itemListElement":[{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog#listItem","position":1,"name":"Home","item":"https:\/\/dev.sapien.com\/blog","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/vbscript\/#listItem","name":"VBScript"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/vbscript\/#listItem","position":2,"name":"VBScript","item":"https:\/\/dev.sapien.com\/blog\/topics\/vbscript\/","nextItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/#listItem","name":"PowerShell MsgBox"},"previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog#listItem","name":"Home"}},{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/#listItem","position":3,"name":"PowerShell MsgBox","previousItem":{"@type":"ListItem","@id":"https:\/\/dev.sapien.com\/blog\/topics\/vbscript\/#listItem","name":"VBScript"}}]},{"@type":"Organization","@id":"https:\/\/dev.sapien.com\/blog\/#organization","name":"DEV SAPIEN Blog","description":"Tools for IT Success","url":"https:\/\/dev.sapien.com\/blog\/"},{"@type":"Person","@id":"https:\/\/dev.sapien.com\/blog\/author\/jeffery-hicks\/#author","url":"https:\/\/dev.sapien.com\/blog\/author\/jeffery-hicks\/","name":"Jeffery Hicks"},{"@type":"WebPage","@id":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/#webpage","url":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/","name":"PowerShell MsgBox - DEV SAPIEN Blog","description":"if you came from the VBScript world you may be missing a few old friends in PowerShell. Because Powershell is a management console, it lacks a GUI unless you create one using Windows forms. Things will change a bit in PowerShell v2.0 but for now let's stick with what we have. If you really need a message box, ala VBScript, then simply call it from PowerShell. All you need to do is use the [microsoft.visualbasic.interaction] class and the MsgBox method.","inLanguage":"en-US","isPartOf":{"@id":"https:\/\/dev.sapien.com\/blog\/#website"},"breadcrumb":{"@id":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/#breadcrumblist"},"author":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/jeffery-hicks\/#author"},"creator":{"@id":"https:\/\/dev.sapien.com\/blog\/author\/jeffery-hicks\/#author"},"datePublished":"2008-08-12T11:00:52-07:00","dateModified":"2008-08-12T11:12:21-07:00"},{"@type":"WebSite","@id":"https:\/\/dev.sapien.com\/blog\/#website","url":"https:\/\/dev.sapien.com\/blog\/","name":"DEV SAPIEN Blog","description":"Tools for IT Success","inLanguage":"en-US","publisher":{"@id":"https:\/\/dev.sapien.com\/blog\/#organization"}}]},"og:locale":"en_US","og:site_name":"DEV SAPIEN Blog - Tools for IT Success","og:type":"article","og:title":"PowerShell MsgBox - DEV SAPIEN Blog","og:description":"if you came from the VBScript world you may be missing a few old friends in PowerShell. Because Powershell is a management console, it lacks a GUI unless you create one using Windows forms. Things will change a bit in PowerShell v2.0 but for now let's stick with what we have. If you really need a message box, ala VBScript, then simply call it from PowerShell. All you need to do is use the [microsoft.visualbasic.interaction] class and the MsgBox method.","og:url":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/","article:published_time":"2008-08-12T19:00:52+00:00","article:modified_time":"2008-08-12T19:12:21+00:00","twitter:card":"summary_large_image","twitter:title":"PowerShell MsgBox - DEV SAPIEN Blog","twitter:description":"if you came from the VBScript world you may be missing a few old friends in PowerShell. Because Powershell is a management console, it lacks a GUI unless you create one using Windows forms. Things will change a bit in PowerShell v2.0 but for now let's stick with what we have. If you really need a message box, ala VBScript, then simply call it from PowerShell. All you need to do is use the [microsoft.visualbasic.interaction] class and the MsgBox method."},"aioseo_meta_data":{"post_id":"596","title":null,"description":null,"keywords":null,"keyphrases":null,"focus_keyword":null,"additional_keywords":null,"truseo_locale":null,"primary_term":null,"canonical_url":null,"og_title":null,"og_description":null,"og_object_type":"default","og_image_type":"default","og_image_custom_url":null,"og_image_custom_fields":null,"og_image_url":null,"og_image_width":null,"og_image_height":null,"og_video":null,"og_custom_url":null,"og_article_section":null,"og_article_tags":null,"twitter_use_og":false,"twitter_card":"default","twitter_image_type":"default","twitter_image_custom_url":null,"twitter_image_custom_fields":null,"twitter_image_url":null,"twitter_title":null,"twitter_description":null,"schema_type":"default","schema_type_options":null,"schema":{"blockGraphs":[],"customGraphs":[],"default":{"data":{"Article":[],"Course":[],"Dataset":[],"FAQPage":[],"Movie":[],"Person":[],"Product":[],"ProductReview":[],"Car":[],"Recipe":[],"Service":[],"SoftwareApplication":[],"WebPage":[]},"graphName":"","isEnabled":true},"graphs":[]},"pillar_content":false,"robots_default":true,"robots_noindex":false,"robots_noarchive":false,"robots_nosnippet":false,"robots_nofollow":false,"robots_noimageindex":false,"robots_noodp":false,"robots_notranslate":false,"robots_max_snippet":null,"robots_max_videopreview":null,"robots_max_imagepreview":"large","priority":null,"frequency":null,"local_seo":null,"limit_modified_date":false,"ai":null,"breadcrumb_settings":null,"seo_analyzer_scan_date":null,"created":"2026-08-28 14:27:50","updated":"2026-08-28 14:27:50"},"aioseo_breadcrumb":"<div class=\"aioseo-breadcrumbs\"><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\" title=\"Home\">Home<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\t<a href=\"https:\/\/dev.sapien.com\/blog\/topics\/vbscript\/\" title=\"VBScript\">VBScript<\/a>\n\t\t<\/span><span class=\"aioseo-breadcrumb-separator\">&raquo;<\/span><span class=\"aioseo-breadcrumb\">\n\t\t\tPowerShell MsgBox\n\t\t<\/span><\/div>","aioseo_breadcrumb_json":[{"label":"Home","link":"https:\/\/dev.sapien.com\/blog"},{"label":"VBScript","link":"https:\/\/dev.sapien.com\/blog\/topics\/vbscript\/"},{"label":"PowerShell MsgBox","link":"https:\/\/dev.sapien.com\/blog\/2008\/08\/12\/powershell-msgbox\/"}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/596","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/comments?post=596"}],"version-history":[{"count":2,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/596\/revisions"}],"predecessor-version":[{"id":597,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/posts\/596\/revisions\/597"}],"wp:attachment":[{"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/media?parent=596"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/categories?post=596"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.sapien.com\/blog\/wp-json\/wp\/v2\/tags?post=596"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}