{"id":5331,"date":"2016-12-22T10:28:30","date_gmt":"2016-12-22T15:28:30","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=5331"},"modified":"2016-12-22T10:28:30","modified_gmt":"2016-12-22T15:28:30","slug":"web-testing-with-powershell","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/","title":{"rendered":"Web Testing with PowerShell"},"content":{"rendered":"<p>I run a self-hosted WordPress blog here as part of a hosted package.\u00a0 I run this on a very tight budget so I'm pretty sure I share resources with other tenants. This means that sometimes the server is unavailable, usually for only a brief period of time. I have the JetPack WordPress plugin configured to monitor when the site is up or down. But I thought I'd add another layer of testing using PowerShell.<\/p>\n<p><!--more--><\/p>\n<p>Fellow MVP <a title=\"you should follow Chrissy on Twitter\" href=\"http:\/\/twitter.com\/cl\" target=\"_blank\">Chrissy LeMaire<\/a> sent me a message on Twitter that my blog was down with a link to the web site <a title=\"http:\/\/downforeveryoneorjustme.com\" href=\"http:\/\/downforeveryoneorjustme.com\">http:\/\/downforeveryoneorjustme.com<\/a>. What I liked about the site is that it produces a very simple page. Once I saw that I realized I could use <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=217035\" target=\"_blank\">Invoke-Webrequest<\/a> and build a simple PowerShell function to scrape the page results.<\/p>\n<p>It is very easy to get the page.<\/p>\n<pre class=\"lang:ps mark:0 decode:true \">$w = Invoke-Webrequest \"http:\/\/downforeveryoneorjustme.com\/blog.jdhitsolutions.com\" -DisableKeepAlive\r\n<\/pre>\n<p>The resulting object will include the parsedHTML as a property. I knew from looking at the page source in my browser that the information I wanted was in a DIV tag with an ID property called \"container\".<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image_thumb-3.png\" alt=\"image\" width=\"644\" height=\"87\" border=\"0\" \/><\/a><\/p>\n<p>With this information I can use the getElementbyID() method to get this item.<\/p>\n<pre class=\"lang:ps mark:0 decode:true \">$x = $w.ParsedHtml.getElementById(\"container\")\r\n<\/pre>\n<p>Fortunately there is only a single result for this ID. If there had been several I would have had to include additional filtering code. All I need to do is look at the InnerText property.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image-4.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image_thumb-4.png\" alt=\"image\" width=\"644\" height=\"144\" border=\"0\" \/><\/a><\/p>\n<p>I can refine this by getting just the first line.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image-5.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image_thumb-5.png\" alt=\"image\" width=\"644\" height=\"75\" border=\"0\" \/><\/a><\/p>\n<p>I now have a few commands that work. Time to build a function around them so I have an easy, re-usable tool. I have put the script file as a <a href=\"https:\/\/gist.github.com\/jdhitsolutions\/3046b3aafcbd89a6d857f7a7a5586e47\" target=\"_blank\">gist on GitHub<\/a>.<\/p>\n<pre class=\"lang:ps decode:true \" >#requires -version 4.0\r\n\r\n# get most current version at https:\/\/gist.github.com\/jdhitsolutions\/3046b3aafcbd89a6d857f7a7a5586e47\r\n\r\nFunction Test-UporDown {\r\n\r\n&lt;#\r\n.Synopsis\r\nTest if a web site is down or if it is just you.\r\n\r\n.Description\r\nThe function uses the web site DownForEveryoneOrJustme.com to test is a web site or domain is up or down, or if the problem is just you. The command will write a custom object to the pipeline. See examples.\r\n.Parameter Name\r\nThe name of a web site or domain such as google.com or powershell.org.\r\n\r\n.Parameter UseUniversalTime\r\nConvert the tested date value to universal or GMT time.\r\n\r\n.Example\r\nPS C:\\&gt; test-upordown pluralsight.com \r\n\r\nName            IsUp Date                 \r\n----            ---- ----                 \r\npluralsight.com True 12\/22\/2016 9:17:00 AM\r\n\r\n.Example\r\nPS S:\\&gt; test-upordown pluralsight.com -UseUniversalTime\r\n\r\nName            IsUp Date                 \r\n----            ---- ----                 \r\npluralsight.com True 12\/22\/2016 2:17:41 PM\r\n\r\n.Example\r\nPS S:\\&gt; test-upordown foofoo.edu -Verbose\r\nVERBOSE: [BEGIN  ] Starting: Test-UporDown\r\nVERBOSE: [PROCESS] Testing foofoo.edu\r\nVERBOSE: GET http:\/\/downforeveryoneorjustme.com\/foofoo.edu\/ with 0-byte payload\r\nVERBOSE: received 2256-byte response of content type text\/html;charset=utf-8\r\nVERBOSE: [PROCESS] It's not just you! http:\/\/foofoo.edu looks down from here. \r\n\r\nVERBOSE: [END    ] Ending: Test-UporDown\r\nName        IsUp Date                 \r\n----        ---- ----                 \r\nfoofoo.edu False 12\/22\/2016 9:19:13 AM\r\n\r\n.Notes\r\nversion: 1.0\r\n\r\nLearn more about PowerShell:\r\n<blockquote class=\"wp-embedded-content\" data-secret=\"qCATeUcmV4\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/essential-powershell-resources\/\">Essential PowerShell Learning Resources<\/a><\/blockquote><iframe loading=\"lazy\" class=\"wp-embedded-content\" sandbox=\"allow-scripts\" security=\"restricted\" style=\"position: absolute; clip: rect(1px, 1px, 1px, 1px);\" title=\"&#8220;Essential PowerShell Learning Resources&#8221; &#8212; The Lonely Administrator\" src=\"https:\/\/jdhitsolutions.com\/blog\/essential-powershell-resources\/embed\/#?secret=l7mVHY1rkh#?secret=qCATeUcmV4\" data-secret=\"qCATeUcmV4\" width=\"600\" height=\"338\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\"><\/iframe>\r\n\r\n.Link\r\nInvoke-WebRequest\r\n\r\n#&gt;\r\n\r\n[cmdletbinding()]\r\nParam(\r\n[Parameter(\r\nPosition = 0, \r\nMandatory, \r\nHelpMessage = \"Enter a web site name, such as google.com.\",\r\nValueFromPipeline\r\n)]\r\n[ValidateNotNullorEmpty()]\r\n[ValidateScript({ $_ -notmatch \"^http\"})]\r\n[string]$Name,\r\n[Switch]$UseUniversalTime\r\n)\r\n\r\nBegin {\r\n    Write-Verbose \"[BEGIN  ] Starting: $($MyInvocation.Mycommand)\"  \r\n} #begin\r\n\r\nProcess {\r\n    Write-Verbose \"[PROCESS] Testing $Name\"\r\n    $response = Invoke-WebRequest -uri \"http:\/\/downforeveryoneorjustme.com\/$Name\/\" -DisableKeepAlive\r\n    #get the result text from the HTML document\r\n    $text = $response.ParsedHtml.getElementById(\"container\").InnerText\r\n\r\n    #the first line has the relevant information that looks like this:\r\n    # It's just you. http:\/\/blog.jdhitsolutions.com is up\r\n    $reply = ($text -split \"`n\" | Select -first 1)\r\n    Write-Verbose \"[PROCESS] $reply\"\r\n\r\n    If ($UseUniversalTime) {\r\n        Write-Verbose \"[PROCESS] Using universal time (GMT)\"\r\n        $testDate = (Get-Date).ToUniversalTime()\r\n    }\r\n    else {\r\n        $testDate = Get-Date\r\n    }\r\n\r\n    #write a result object to the pipeline\r\n    [pscustomObject]@{\r\n        Name = $Name\r\n        IsUp = $reply -match \"\\bis up\\b\"\r\n        Date = $TestDate\r\n    }\r\n    \r\n} #process\r\n\r\nEnd {\r\n    Write-Verbose \"[END    ] Ending: $($MyInvocation.Mycommand)\"\r\n} #end\r\n\r\n}\r\n\r\n#define an optional alias\r\nSet-Alias -Name tup -Value Test-UporDown\r\n\r\n<\/pre>\n<p>The script also includes an alias. I also added a parameter to return the tested date time in GMT should you need that.<\/p>\n<p>Now, it is very easy to test if a site is up or down.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image-6.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image_thumb-6.png\" alt=\"image\" width=\"613\" height=\"175\" border=\"0\" \/><\/a><\/p>\n<p>I'm not sure what sort of monitoring and reporting tool I'll build with this, but hopefully it will be worth blogging about. In the mean time, give this a shot and let me know what you think. If you run into problems with the code, please post something in the discussion section on the Gist page.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I run a self-hosted WordPress blog here as part of a hosted package.\u00a0 I run this on a very tight budget so I&#8217;m pretty sure I share resources with other tenants. This means that sometimes the server is unavailable, usually for only a brief period of time. I have the JetPack WordPress plugin configured to&#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 on the blog: Web Testing with #PowerShell","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":[410,534],"class_list":["post-5331","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-invoke-webrequest","tag-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Web Testing with PowerShell &#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\/5331\/web-testing-with-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Web Testing with PowerShell &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I run a self-hosted WordPress blog here as part of a hosted package.\u00a0 I run this on a very tight budget so I&#039;m pretty sure I share resources with other tenants. This means that sometimes the server is unavailable, usually for only a brief period of time. I have the JetPack WordPress plugin configured to...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2016-12-22T15:28:30+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image_thumb-3.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=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5331\\\/web-testing-with-powershell\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5331\\\/web-testing-with-powershell\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Web Testing with PowerShell\",\"datePublished\":\"2016-12-22T15:28:30+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5331\\\/web-testing-with-powershell\\\/\"},\"wordCount\":371,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5331\\\/web-testing-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/image_thumb-3.png\",\"keywords\":[\"Invoke-WebRequest\",\"PowerShell\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5331\\\/web-testing-with-powershell\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5331\\\/web-testing-with-powershell\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5331\\\/web-testing-with-powershell\\\/\",\"name\":\"Web Testing with PowerShell &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5331\\\/web-testing-with-powershell\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5331\\\/web-testing-with-powershell\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/image_thumb-3.png\",\"datePublished\":\"2016-12-22T15:28:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5331\\\/web-testing-with-powershell\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5331\\\/web-testing-with-powershell\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5331\\\/web-testing-with-powershell\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/image_thumb-3.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2016\\\/12\\\/image_thumb-3.png\",\"width\":644,\"height\":87},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5331\\\/web-testing-with-powershell\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Web Testing with PowerShell\"}]},{\"@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":"Web Testing with PowerShell &#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\/5331\/web-testing-with-powershell\/","og_locale":"en_US","og_type":"article","og_title":"Web Testing with PowerShell &#8226; The Lonely Administrator","og_description":"I run a self-hosted WordPress blog here as part of a hosted package.\u00a0 I run this on a very tight budget so I'm pretty sure I share resources with other tenants. This means that sometimes the server is unavailable, usually for only a brief period of time. I have the JetPack WordPress plugin configured to...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/","og_site_name":"The Lonely Administrator","article_published_time":"2016-12-22T15:28:30+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image_thumb-3.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":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Web Testing with PowerShell","datePublished":"2016-12-22T15:28:30+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/"},"wordCount":371,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image_thumb-3.png","keywords":["Invoke-WebRequest","PowerShell"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/","name":"Web Testing with PowerShell &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image_thumb-3.png","datePublished":"2016-12-22T15:28:30+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image_thumb-3.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/12\/image_thumb-3.png","width":644,"height":87},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5331\/web-testing-with-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Web Testing with PowerShell"}]},{"@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":3084,"url":"https:\/\/jdhitsolutions.com\/blog\/training\/3084\/browse-trainsignal-courses-with-powershell\/","url_meta":{"origin":5331,"position":0},"title":"Browse TrainSignal Courses with PowerShell","author":"Jeffery Hicks","date":"June 5, 2013","format":false,"excerpt":"It took longer than I expected, but my latest course for TrainSignal is now available. PowerShell v3 Essentials is targeted for IT Pros with little to no PowerShell experience. This is the course that will get you up and running in short order. I developed the course so that an\u2026","rel":"","context":"In &quot;Powershell 3.0&quot;","block_context":{"text":"Powershell 3.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-3-0\/"},"img":{"alt_text":"talkbubble-v3","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/05\/talkbubble-v3-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2639,"url":"https:\/\/jdhitsolutions.com\/blog\/friday-fun\/2639\/friday-fun-scraping-the-web-with-powershell-v3\/","url_meta":{"origin":5331,"position":1},"title":"Friday Fun: Scraping the Web with PowerShell v3","author":"Jeffery Hicks","date":"December 21, 2012","format":false,"excerpt":"We often think about PowerShell v3 as being a management tool for the cloud. One new PowerShell v3 cmdlet that lends substance to this idea is Invoke-WebRequest. This is a handy for retrieving data from a web site resource. It might be a public web site or something on your\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2841,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2841\/friday-fun-get-beer-list\/","url_meta":{"origin":5331,"position":2},"title":"Friday Fun Get Beer List","author":"Jeffery Hicks","date":"March 8, 2013","format":false,"excerpt":"Well, another Friday and what goes better with it than beer. Of course I should mix in a little PowerShell as well. I live in the Syracuse, NY area and we have a terrific local brewery, Middle Ages Brewing Company. Not only is there a tasting room, but I can\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"beer","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/03\/beer-150x150.jpg?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":6035,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6035\/making-short-links-long-with-powershell-and-wpf\/","url_meta":{"origin":5331,"position":3},"title":"Making Short Links Long with PowerShell and WPF","author":"Jeffery Hicks","date":"July 9, 2018","format":false,"excerpt":"Sometimes, when I have nothing better to do, I kill some time giving Todd Klindt and Shane Young a hard time during their podcast. You should join me sometime. Anyway, during a recent show Todd mentioned a bit of PowerShell code he put together to resolve short links. You see\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\/2018\/07\/image_thumb-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/07\/image_thumb-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/07\/image_thumb-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/07\/image_thumb-1.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4342,"url":"https:\/\/jdhitsolutions.com\/blog\/friday-fun\/4342\/friday-fun-whats-my-ip\/","url_meta":{"origin":5331,"position":4},"title":"Friday Fun: What&#8217;s My IP","author":"Jeffery Hicks","date":"April 3, 2015","format":false,"excerpt":"Today's Friday Fun is a \"quick and dirty\" solution to the question, \"What is my public IP address?\" There are plenty of web sites and services you can visit that will display that piece of information. Naturally I want an easy way to get this in PowerShell. Recently I came\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"getmyip","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2015\/04\/getmyip-1024x345.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":3093,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3093\/friday-fun-its-powershell-baby\/","url_meta":{"origin":5331,"position":5},"title":"Friday Fun: It&#8217;s PowerShell, Baby!","author":"Jeffery Hicks","date":"June 7, 2013","format":false,"excerpt":"The other day I received an email looking for guidance on using Invoke-Webrequest to pull data from a table on a web page. Specifically, he wanted to get the list of popular baby names from http:\/\/www.ssa.gov\/OACT\/babynames\/index.html. I gave him some quick tips but figured this would also be another teaching\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"baby","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/06\/baby-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5331","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=5331"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5331\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=5331"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=5331"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=5331"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}