{"id":2809,"date":"2013-02-22T08:51:58","date_gmt":"2013-02-22T13:51:58","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=2809"},"modified":"2013-02-22T08:51:58","modified_gmt":"2013-02-22T13:51:58","slug":"powershell-morning-report-with-credentials","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/","title":{"rendered":"PowerShell Morning Report with Credentials"},"content":{"rendered":"<p>I had an email about trying to use my Morning Report script to connect to machines that required alternate credentials. For example, you might have non-domain systems in a DMZ. Fair enough. Since most of the report script uses WMI, it wasn't too hard to add a Credential parameter and modify the WMI code to use it. I tweaked the code a bit to use hashtables to splat parameters.<\/p>\n<p><code lang=\"PowerShell\"><br \/>\n#region define a parameter hashtable<br \/>\n$paramhash=@{<br \/>\nClassname=\"Win32_OperatingSystem\"<br \/>\nComputername=$Computername<br \/>\nErrorAction=\"Stop\"<br \/>\n}<\/p>\n<p>if ($credential) {<br \/>\n $paramhash.Add(\"Credential\",$Credential)<br \/>\n}<br \/>\nIf ($OK) {<\/p>\n<p>    Try {<br \/>\n        #get Operating system information from WMI<br \/>\n        $os = Get-WmiObject @paramhash<br \/>\n...<br \/>\n<\/code><\/p>\n<p>I'm a little mixed on using splatting in the script. On one hand it makes it easier to wrap up parameters but the actual command might be a little confusing. Hopefully the comments make it clear.<\/p>\n<p>So that handled all the WMI parts. The event log section is using Get-Eventlog which doesn't have a -Credential parameter. I could have tried to rewrite the section using WMI, but that seemed like a lot of work. So I made the assumption that the computers you are querying are running PowerShell 2 or later with remoting enabled. That means I can use Invoke-Command to run Get-Eventlog ON the remote computer. As an additional benefit this seems to run a little faster, at least in my testing.<\/p>\n<p>The tricky part was passing all the parameter values to Get-EventLog and Invoke-Command. I ended up with some complicated nesting but it works.<\/p>\n<p><code lang=\"PowerShell\"><br \/>\n#Event log errors and warnings in the last $Hours hours<br \/>\n$last=(Get-Date).AddHours(-$Hours)<br \/>\n#define a hash table of parameters to splat to Get-Eventlog<br \/>\n$GetEventLogParam = @{<br \/>\nLogName=\"System\"<br \/>\nEntryType=\"Error\",\"Warning\"<br \/>\nAfter=$last}<\/p>\n<p>#System Log<br \/>\nWrite-Host \"...System Event Log Error\/Warning since $last\" -ForegroundColor Cyan<br \/>\n#hashtable of optional parameters for Invoke-Command<br \/>\n$InvokeCommandParam = @{<br \/>\n    Computername=$Computername<br \/>\n    ArgumentList=$GetEventLogParam<br \/>\n    ScriptBlock = {Param ($params) Get-EventLog @params }<br \/>\n}<\/p>\n<p>if ($Credential) { $InvokeCommandParam.Add(\"Credential\",$Credential) }<\/p>\n<p>$syslog = Invoke-Command @InvokeCommandParam<\/p>\n<p>$syslogdata = $syslog | Select TimeGenerated,EventID,Source,Message<\/p>\n<p>#Application Log<br \/>\nWrite-Host \"...Application Event Log Error\/Warning since $last\" -ForegroundColor Cyan<br \/>\n#update the hashtable<br \/>\n$GetEventLogParam.LogName=\"Application\"<\/p>\n<p>#update invoke-command parameters<br \/>\n$InvokeCommandParam.ArgumentList = $GetEventLogParam<\/p>\n<p>$applog = Invoke-Command @InvokeCommandParam<br \/>\n$applogdata = $applog | Select TimeGenerated,EventID,Source,Message<br \/>\n<\/code><\/p>\n<p>Now you can run the script using -Credential, specifying either a saved credential object or the user name which will give you the Get-Credential prompt. I also made some slight tweaks to the embedded style and layout.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.png\" alt=\"morning report\" width=\"625\" height=\"399\" class=\"aligncenter size-large wp-image-2810\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.png 1024w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-300x191.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-624x398.png 624w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred.png 1078w\" sizes=\"auto, (max-width: 625px) 100vw, 625px\" \/><\/a><\/p>\n<p>If you missed the original and related posts, you might want to read:<br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/2012\/01\/the-powershell-morning-report\/\" title=\"read the original article\" target=\"_blank\">http:\/\/jdhitsolutions.com\/blog\/2012\/01\/the-powershell-morning-report\/<\/a><br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/2012\/02\/morning-report-revised\/\" title=\"read about a change to the report\" target=\"_blank\">http:\/\/jdhitsolutions.com\/blog\/2012\/02\/morning-report-revised\/<\/a><br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/2012\/08\/event-log-morning-report\/\" title=\"read about a related script\" target=\"_blank\">http:\/\/jdhitsolutions.com\/blog\/2012\/08\/event-log-morning-report\/<\/a><\/p>\n<p>Download the latest version of the <a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/MorningReport-v2.txt\" target='_blank'>MorningReport<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I had an email about trying to use my Morning Report script to connect to machines that required alternate credentials. For example, you might have non-domain systems in a DMZ. Fair enough. Since most of the report script uses WMI, it wasn&#8217;t too hard to add a Credential parameter and modify the WMI code 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":"","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,19],"tags":[136,103,237,534,397,540,417,547],"class_list":["post-2809","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","category-wmi","tag-get-eventlog","tag-get-wmiobject","tag-html","tag-powershell","tag-reporting","tag-scripting","tag-splatting","tag-wmi"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>PowerShell Morning Report with Credentials &#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\/2809\/powershell-morning-report-with-credentials\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"PowerShell Morning Report with Credentials &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"I had an email about trying to use my Morning Report script to connect to machines that required alternate credentials. For example, you might have non-domain systems in a DMZ. Fair enough. Since most of the report script uses WMI, it wasn&#039;t too hard to add a Credential parameter and modify the WMI code to...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2013-02-22T13:51:58+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.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=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2809\\\/powershell-morning-report-with-credentials\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2809\\\/powershell-morning-report-with-credentials\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"PowerShell Morning Report with Credentials\",\"datePublished\":\"2013-02-22T13:51:58+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2809\\\/powershell-morning-report-with-credentials\\\/\"},\"wordCount\":294,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2809\\\/powershell-morning-report-with-credentials\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/02\\\/morningreport-revised-cred-1024x654.png\",\"keywords\":[\"Get-Eventlog\",\"Get-WMIObject\",\"HTML\",\"PowerShell\",\"Reporting\",\"Scripting\",\"splatting\",\"WMI\"],\"articleSection\":[\"PowerShell\",\"Scripting\",\"WMI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2809\\\/powershell-morning-report-with-credentials\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2809\\\/powershell-morning-report-with-credentials\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2809\\\/powershell-morning-report-with-credentials\\\/\",\"name\":\"PowerShell Morning Report with Credentials &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2809\\\/powershell-morning-report-with-credentials\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2809\\\/powershell-morning-report-with-credentials\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/02\\\/morningreport-revised-cred-1024x654.png\",\"datePublished\":\"2013-02-22T13:51:58+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2809\\\/powershell-morning-report-with-credentials\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2809\\\/powershell-morning-report-with-credentials\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2809\\\/powershell-morning-report-with-credentials\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/02\\\/morningreport-revised-cred.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2013\\\/02\\\/morningreport-revised-cred.png\",\"width\":1078,\"height\":689,\"caption\":\"morning report\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/2809\\\/powershell-morning-report-with-credentials\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PowerShell Morning Report with Credentials\"}]},{\"@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":"PowerShell Morning Report with Credentials &#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\/2809\/powershell-morning-report-with-credentials\/","og_locale":"en_US","og_type":"article","og_title":"PowerShell Morning Report with Credentials &#8226; The Lonely Administrator","og_description":"I had an email about trying to use my Morning Report script to connect to machines that required alternate credentials. For example, you might have non-domain systems in a DMZ. Fair enough. Since most of the report script uses WMI, it wasn't too hard to add a Credential parameter and modify the WMI code to...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/","og_site_name":"The Lonely Administrator","article_published_time":"2013-02-22T13:51:58+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.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":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"PowerShell Morning Report with Credentials","datePublished":"2013-02-22T13:51:58+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/"},"wordCount":294,"commentCount":2,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.png","keywords":["Get-Eventlog","Get-WMIObject","HTML","PowerShell","Reporting","Scripting","splatting","WMI"],"articleSection":["PowerShell","Scripting","WMI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/","name":"PowerShell Morning Report with Credentials &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.png","datePublished":"2013-02-22T13:51:58+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred.png","width":1078,"height":689,"caption":"morning report"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"PowerShell Morning Report with Credentials"}]},{"@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":3497,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3497\/resolving-sids-with-wmi-wsman-and-powershell\/","url_meta":{"origin":2809,"position":0},"title":"Resolving SIDs with WMI, WSMAN and PowerShell","author":"Jeffery Hicks","date":"October 15, 2013","format":false,"excerpt":"In the world of Windows, an account SID can be a very enigmatic thing. Who is S-1-5-21-2250542124-3280448597-2353175939-1019? Fortunately, many applications, such as the event log viewer resolve the SID to an account name. The downside, is that when you are accessing that same type of information from PowerShell, you end\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"win32_sid-fail","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/10\/win32_sid-fail-1024x330.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/10\/win32_sid-fail-1024x330.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/10\/win32_sid-fail-1024x330.png?resize=525%2C300 1.5x"},"classes":[]},{"id":2182,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2182\/scripting-with-pscredential\/","url_meta":{"origin":2809,"position":1},"title":"Scripting with PSCredential","author":"Jeffery Hicks","date":"April 10, 2012","format":false,"excerpt":"I see this question often: how can I pass a parameter value for a PSCredential that might be a credential object or it might be a user name? In the past I've used code like this: begin { Write-Verbose -Message \"Starting $($myinvocation.mycommand)\" write-verbose -Message \"Using volume $($volume.toUpper())\" #convert credential to\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":449,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/449\/drive-report-console-chart\/","url_meta":{"origin":2809,"position":2},"title":"Drive Report Console Chart","author":"Jeffery Hicks","date":"October 15, 2009","format":false,"excerpt":"In thinking about some of my recent posts, I realize I should make clear that these scripts and functions are not necessarily good PowerShell examples. They don\u2019t take advantage of objects and the pipeline. They are single purpose and one-dimensional. Not that there\u2019s anything wrong with that. My recent examples,\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"drivereport screenshot","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2009\/10\/drivereport_thumb.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":37,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/37\/get-active-directory-user-information-in-powershell\/","url_meta":{"origin":2809,"position":3},"title":"Get Active Directory User Information in PowerShell","author":"Jeffery Hicks","date":"July 5, 2006","format":false,"excerpt":"One feature that PowerShell will likely be missing when it first ships is solid support for ADSI and working with Active Directory. You can use .NET DirectoryEntry objects but it feels more like programming and less like scripting. Another option for working with Active Directory in PowerShell is to use\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":1977,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/1977\/the-powershell-morning-report\/","url_meta":{"origin":2809,"position":4},"title":"The PowerShell Morning Report","author":"Jeffery Hicks","date":"January 10, 2012","format":false,"excerpt":"I love how easy it is to manage computers with Windows PowerShell. It is a great reporting tool, but often I find people getting locked into one approach. I'm a big believer in flexibility and re-use and using objects in the pipeline wherever I can. So I put together a\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"Zazu","src":"https:\/\/i0.wp.com\/www.lionking.org\/imgarchive\/Clip_Art\/zazu03.gif?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":1201,"url":"https:\/\/jdhitsolutions.com\/blog\/wmi\/1201\/new-event-report-revised\/","url_meta":{"origin":2809,"position":5},"title":"New Event Report Revised","author":"Jeffery Hicks","date":"March 8, 2011","format":false,"excerpt":"Last year I posted an update to an old Mr. Roboto script that was an update to an even older VBScript. Still with me? My last revision leveraged the new Get-WinEvent cmdlet to create an HTML report of recent error activity on one or more computers. The problem was that\u2026","rel":"","context":"In &quot;Mr. Roboto&quot;","block_context":{"text":"Mr. Roboto","link":"https:\/\/jdhitsolutions.com\/blog\/category\/mr-roboto\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2809","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=2809"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/2809\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=2809"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=2809"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=2809"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}