Writing debug information to an IE window
This is a trick I’ve used a lot in VBScript - writing debug messages to a browser window. It isn’t necessary if you use an editor like PrimalScript, which redirects Write-Debug output to another pane for you. But if you’re working in Notepad or something, this can be a good trick for separating debug output from your script’s main output.
- # # ScriptingAnswers.com Essentials # copyright 2006 SAPIEN Technologies, Inc. # # IE-based Debug Window # # add this to the beginning of your script: $ie = New-Object -comobject "InternetExplorer.Application" Function Debug($text) { # uncomment the next line to disable debugging # return if ($ie.visible -ne $true) { $ie.visible = $true $ie.navigate("about:blank") $ie.ToolBar = $False $ie.Width = 200 $ie.Height = 300 $ie.Left = 10 $ie.Top = 10 } $body = $ie.document.body.innerhtml $body += $text $ie.document.body.innerhtml = $body } # to use: # Debug("whatever") # will cause 'whatever' to appear in a pop-up window
Tags: debug, debugging, ie, internet explorer, powershell, window, write-debug










