{"id":3543,"date":"2013-11-06T08:27:41","date_gmt":"2013-11-06T13:27:41","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=3543"},"modified":"2015-11-20T13:35:26","modified_gmt":"2015-11-20T18:35:26","slug":"more-powershell-trace-window-fun","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/","title":{"rendered":"More PowerShell Trace Window Fun"},"content":{"rendered":"<p>On my last Friday Fun, I posted an article about <a href=\"http:\/\/jdhitsolutions.com\/blog\/scripting\/3538\/friday-fun-create-a-powershell-trace-window\/\" title=\"Friday Fun: Create a PowerShell Trace Window\" target=\"_blank\">using Internet Explorer as a trace window<\/a>. The idea was to put debug or trace messages in a separate application. I received a comment on the post that suggested I could do a similar thing using the <a href=\"http:\/\/technet.microsoft.com\/en-us\/sysinternals\/bb896647\" title=\"get Debug View\" target=\"_blank\">Debug View<\/a> utility from Sysinternals. This application is used to capture debug messages so I thought I'd give it a try. <\/p>\n<p>After you download it, you will run to manually run it once to accept licensing terms and setup a filter. I'm assuming you don't regularly use this program for anything else. Depending on your computer you may not need a filter but it is the best way to work with my Debug-Message function.<\/p>\n<pre class=\"lang:ps decode:true \" >#requires -version 2.0\r\n\r\n&lt;#\r\n Requires dbgview.exe from Sysinternals to be in your path or \r\n modify the function. You should set up a filter in dbview.exe\r\n before using this to filter on the Category.\r\n#&gt;\r\n\r\nFunction Debug-Message {\r\n\r\n[cmdletbinding()]\r\nParam(\r\n[Parameter(Position=0,Mandatory=$True,HelpMessage=\"Enter a message\")]\r\n[string]$Message,\r\n[string]$Category=\"PS Trace\"\r\n)\r\n\r\n#only run if $TraceEnabled is True\r\nif ($script:TraceEnabled) {\r\n    #test if dbgview.exe is already running and start it if not.\r\n    if (-NOT (Get-Process -Name Dbgview -ErrorAction SilentlyContinue)) {\r\n      Try {\r\n        #start with \/f to skip filter confirmation prompt\r\n        Start-Process G:\\Sysinternals\\Dbgview.exe \/f\r\n        #give the application to start\r\n        Start-Sleep -Seconds 1\r\n      }\r\n      Catch {\r\n        Write-Warning \"Failed to find or start dbgview.exe\"\r\n        Return\r\n      }\r\n    } #if dbgview is not running\r\n\r\n    #display the message in dbgview.exe\r\n    [System.Diagnostics.Debug]::WriteLine($Message,$Category)\r\n\r\n} #if $TraceEnabled\r\n\r\n} #close Debug-Message\r\n\r\nSet-Alias -Name Trace -Value Debug-Message<\/pre>\n<p>The essence of this function is the [System.Diagnostics.Debug]::WriteLine($Message,$Category) line. The Category will show up as a prefix to the message in the Debug View window. I set a filter in Debug View on that category, ie PS Trace*. This function, like my IE trace function, relies on a variable $TraceEnabled to be set to $True.  If the dbgview.exe process isn't running, the function starts it. I have hardcoded the path to dbgview.exe which you'll need to adjust. The easiest approach is to drop dbgview.exe into your Windows folder or modify your %PATH% variable to include your Sysinternals folder.<\/p>\n<p>Using the function is no different than my IE version. In fact, in my demo script all I needed to do was change which script gets dot-sourced.<\/p>\n<pre class=\"lang:ps decode:true \" ># !!!!!!!!!!!!!!!!!!!!!!!!!!!!! \r\n# dot source the Trace function\r\n#. C:\\scripts\\Trace.ps1\r\n. C:\\scripts\\Debug-Message.ps1\r\n# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!\r\n#&gt;\r\nif ($Trace) {\r\n  #set the variable to turn tracing on\r\n  $script:TraceEnabled = $True\r\n}<\/pre>\n<p>I added a \"Trace\" alias to my new Debug View function so don't have to change anything else. When I run my script using the -Trace parameter, I get a handy trace window like this.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/dbgview-trace.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/dbgview-trace-300x290.png\" alt=\"dbgview-trace\" width=\"300\" height=\"290\" class=\"aligncenter size-medium wp-image-3544\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/dbgview-trace-300x290.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/dbgview-trace-624x603.png 624w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/dbgview-trace.png 851w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>What's handy about this utility is that it is easy to save the results to a file. I also don't have to deal with messy COM objects. If you don't setup the filter ahead of time you may have a hard time finding the trace messages from your script. But that's your choice.<\/p>\n<p>What do you think?<\/p>\n","protected":false},"excerpt":{"rendered":"<p>On my last Friday Fun, I posted an article about using Internet Explorer as a trace window. The idea was to put debug or trace messages in a separate application. I received a comment on the post that suggested I could do a similar thing using the Debug View utility from Sysinternals. This application is&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New Stuff: More #PowerShell Trace Window Fun","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,8],"tags":[224,534,540,47],"class_list":["post-3543","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-function","tag-powershell","tag-scripting","tag-sysinternals"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>More PowerShell Trace Window Fun &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"More PowerShell Trace Window Fun &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"On my last Friday Fun, I posted an article about using Internet Explorer as a trace window. The idea was to put debug or trace messages in a separate application. I received a comment on the post that suggested I could do a similar thing using the Debug View utility from Sysinternals. This application is...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2013-11-06T13:27:41+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-11-20T18:35:26+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/dbgview-trace-300x290.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3543\\\/more-powershell-trace-window-fun\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3543\\\/more-powershell-trace-window-fun\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"More PowerShell Trace Window Fun\",\"datePublished\":\"2013-11-06T13:27:41+00:00\",\"dateModified\":\"2015-11-20T18:35:26+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3543\\\/more-powershell-trace-window-fun\\\/\"},\"wordCount\":361,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3543\\\/more-powershell-trace-window-fun\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/11\\\/dbgview-trace-300x290.png\",\"keywords\":[\"Function\",\"PowerShell\",\"Scripting\",\"Sysinternals\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3543\\\/more-powershell-trace-window-fun\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3543\\\/more-powershell-trace-window-fun\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3543\\\/more-powershell-trace-window-fun\\\/\",\"name\":\"More PowerShell Trace Window Fun &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3543\\\/more-powershell-trace-window-fun\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3543\\\/more-powershell-trace-window-fun\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/11\\\/dbgview-trace-300x290.png\",\"datePublished\":\"2013-11-06T13:27:41+00:00\",\"dateModified\":\"2015-11-20T18:35:26+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3543\\\/more-powershell-trace-window-fun\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3543\\\/more-powershell-trace-window-fun\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3543\\\/more-powershell-trace-window-fun\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/11\\\/dbgview-trace.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/11\\\/dbgview-trace.png\",\"width\":851,\"height\":823},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3543\\\/more-powershell-trace-window-fun\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"More PowerShell Trace Window Fun\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"More PowerShell Trace Window Fun &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/","og_locale":"en_US","og_type":"article","og_title":"More PowerShell Trace Window Fun &#8226; The Lonely Administrator","og_description":"On my last Friday Fun, I posted an article about using Internet Explorer as a trace window. The idea was to put debug or trace messages in a separate application. I received a comment on the post that suggested I could do a similar thing using the Debug View utility from Sysinternals. This application is...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/","og_site_name":"The Lonely Administrator","article_published_time":"2013-11-06T13:27:41+00:00","article_modified_time":"2015-11-20T18:35:26+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/dbgview-trace-300x290.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"More PowerShell Trace Window Fun","datePublished":"2013-11-06T13:27:41+00:00","dateModified":"2015-11-20T18:35:26+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/"},"wordCount":361,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/dbgview-trace-300x290.png","keywords":["Function","PowerShell","Scripting","Sysinternals"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/","name":"More PowerShell Trace Window Fun &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/dbgview-trace-300x290.png","datePublished":"2013-11-06T13:27:41+00:00","dateModified":"2015-11-20T18:35:26+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/dbgview-trace.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/11\/dbgview-trace.png","width":851,"height":823},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3543\/more-powershell-trace-window-fun\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"More PowerShell Trace Window Fun"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":1589,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1589\/verbose-or-debug\/","url_meta":{"origin":3543,"position":0},"title":"Verbose or Debug?","author":"Jeffery Hicks","date":"August 8, 2011","format":false,"excerpt":"This morning there was some discussion on Twitter about when to use Write-Verbose and when to use Write-Debug. They both can provide additional information about what your script or function is doing, although you have to write the code. Typically, I use Write-Verbose to provide trace and flow messages. When\u2026","rel":"","context":"In &quot;Best Practices&quot;","block_context":{"text":"Best Practices","link":"https:\/\/jdhitsolutions.com\/blog\/category\/best-practices\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/08\/demo-write-verbose-300x110.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":7865,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7865\/tracing-powershell-with-wpf\/","url_meta":{"origin":3543,"position":1},"title":"Tracing PowerShell with WPF","author":"Jeffery Hicks","date":"November 11, 2020","format":false,"excerpt":"Back in my VBScript days, I had a script that would use Internet Explorer as a trace window. My script could run and messages would be written to an IE window. This was a handy way of separating debug or trace messages from the command output. When PowerShell came along\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/trace-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/trace-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/trace-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/11\/trace-1.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4895,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4895\/friday-fun-a-sysinternals-powershell-workflow\/","url_meta":{"origin":3543,"position":2},"title":"Friday Fun: A SysInternals PowerShell Workflow","author":"Jeffery Hicks","date":"February 12, 2016","format":false,"excerpt":"Over the years I've come up with a number of PowerShell tools to download the SysInternals tools to my desktop. And yes, I know that with PowerShell 5 and PowerShellGet I could download and install a SysInternals package. But that assumes the package is current.\u00a0 But that's not really the\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"image","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/02\/image_thumb-5.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/02\/image_thumb-5.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/02\/image_thumb-5.png?resize=525%2C300 1.5x"},"classes":[]},{"id":1603,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1603\/select-object-properties-with-values\/","url_meta":{"origin":3543,"position":3},"title":"Select Object Properties with Values","author":"Jeffery Hicks","date":"August 16, 2011","format":false,"excerpt":"Here's another concept I know I've written about in the past but that needed an update. A common technique I use when exploring and discovering objects is to pipe the object to Select-Object specifying all properties, get-service spooler | select *. There's nothing wrong with this approach but depending on\u2026","rel":"","context":"In &quot;PowerShell v2.0&quot;","block_context":{"text":"PowerShell v2.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-v2-0\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":3881,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3881\/scraping-sysinternals\/","url_meta":{"origin":3543,"position":4},"title":"Scraping Sysinternals","author":"Jeffery Hicks","date":"June 16, 2014","format":false,"excerpt":"Recently I was conversing with someone about my PowerShell code that downloads tools from the live Sysinternals site. If you search the Internet, you'll find plenty of ways to achieve the same goal. But we were running into a problem where PowerShell was failing to get information from the site.\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"download-thumb","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/06\/download-thumb.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":407,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/407\/is-that-folder-empty\/","url_meta":{"origin":3543,"position":5},"title":"Is That Folder Empty?","author":"Jeffery Hicks","date":"September 30, 2009","format":false,"excerpt":"In keeping with my recent trend of offering solutions based on PowerShell v2.0, here's a function I've revised to test if a folder is empty. I can't recall where I used the original function or if I ever did. But I came across it recently and decided to give it\u2026","rel":"","context":"In &quot;CommandLine&quot;","block_context":{"text":"CommandLine","link":"https:\/\/jdhitsolutions.com\/blog\/category\/commandline\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/09\/zrtn_003p5cb42026_tn.jpg?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3543","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=3543"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3543\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=3543"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=3543"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=3543"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}