{"id":3504,"date":"2013-10-18T10:29:27","date_gmt":"2013-10-18T14:29:27","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=3504"},"modified":"2013-10-18T12:22:57","modified_gmt":"2013-10-18T16:22:57","slug":"runspaces-remoting-and-workflow-oh-my","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/","title":{"rendered":"Runspaces, Remoting and Workflow, Oh My!"},"content":{"rendered":"<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.png\" alt=\"talkbubble\" width=\"198\" height=\"208\" class=\"alignleft size-full wp-image-1688\" \/><\/a>The other day on Twitter I saw a message about new script in the Microsoft Script Center on getting remote event logs with WMI. So I took a look at the <a href=\"http:\/\/gallery.technet.microsoft.com\/scriptcenter\/Get-Remote-Event-Logs-With-35a3a58e\" title=\"Get Remote Event Logs with PowerShell\" target=\"_blank\">script<\/a>. If you take a minute to look at the script you'll quickly realize this is not a script for beginners. My initial thought was \"Why?\". We already have cmdlets in PowerShell for querying event logs on remote computers. I realize the script was trying to avoid some of the issues we run into with WMI and I can't question the effectiveness of his function. It works and with out a doubt using runspaces like this is faster than cmdlets. <\/p>\n<p>My concern when I see scripts like this is that someone new to PowerShell will see it and run to the hills thinking they'll never be able to use PowerShell and that is definitely not the case. So I decided to see what I could come up with that used a more IT Pro friendly cmdlet-based approach. I wanted to write something that most of you could have come up with. <\/p>\n<p>My first attempt is a function that uses Invoke-Command to run the Get-Eventlog cmdlets in a remote session. In the function I define a scriptblock that gets all the event logs with records, and then gets all non-information or SuccessAudit events from those logs that have happended since midnight yesterday. My function supports credentials and takes advantage of a few other features from Invoke-Command.<\/p>\n<pre class=\"lang:ps decode:true \" >Function Get-RecentEventLog {\r\n\r\n[CmdletBinding()]\r\n[OutputType([System.Diagnostics.EventLogEntry])]\r\n\r\nParam(\r\n[Parameter(Position=0,HelpMessage=\"Enter the name of a computer\")]\r\n[ValidateNotNullorEmpty()]\r\n[Alias(\"cn\",\"pscomputername\",\"name\")]\r\n[string[]]$Computername=$env:COMPUTERNAME,\r\n[ValidateScript({$_ -ge 1})]\r\n[int]$Days=1,\r\n[Alias(\"RunAs\")]\r\n[System.Management.Automation.Credential()]$Credential = [System.Management.Automation.PSCredential]::Empty,\r\n[ValidateScript({$_ -ge 1})]\r\n[int]$ThrottleLimit=32,\r\n[switch]$Asjob,\r\n[string]$JobName\r\n)\r\n\r\nBegin {\r\n    Write-Verbose -Message \"Starting $($MyInvocation.Mycommand)\"     \r\n} #begin\r\n\r\nProcess {\r\n\r\n#define a scriptblock to search event logs that will run remotely via Invoke-Command\r\n$sb = {\r\n\r\n$logs = Get-Eventlog -List | where {$_.entries.count -gt 0}\r\n\r\nif ($logs) {   \r\n    #construct a filter hashtable    \r\n    $filterParams= @{\r\n        Logname= $Null\r\n        After= (Get-Date).AddDays(-$using:Days).Date\r\n        EntryType= \"error\",\"warning\",\"failureaudit\"\r\n        ErrorAction=\"stop\"\r\n     }\r\n\r\n    foreach ($log in $logs) {\r\n        $filterParams.Logname = $log.log\r\n        #add the log name to each entry\r\n        Write-Verbose \"Processing $($log.log) on $env:computername\"\r\n        Try {\r\n        Get-Eventlog @filterParams | \r\n        Add-Member -MemberType NoteProperty -Name Logname -value $log -PassThru\r\n        }\r\n        Catch {\r\n            #ignore errors because they are probably for no matching records\r\n        }\r\n    } #foreach log\r\n\r\n} #if $logs\r\n\r\n} #close scriptblock\r\n\r\n    #create a hashtable of parameters for Invoke-Command\r\n    #use the bound parameters as a starting point\r\n    $icmParam=$PSBoundParameters\r\n\r\n    if ($icmParam.ContainsKey(\"Days\")) {\r\n      #remove Days since it isn't used by Invoke-Command\r\n       $icmParam.Remove(\"Days\")\r\n    }\r\n    #add the other parameters\r\n    $icmParam.Add(\"Scriptblock\",$sb)\r\n    $icmParam.Add(\"ErrorAction\",\"Stop\")\r\n    $icmParam.Add(\"ErrorVariable\",\"myErr\")\r\n\r\n     Try {\r\n        Write-Verbose \"Initiating Invoke-Command\"\r\n        Write-Verbose \"Getting event logs from the past $days day(s)\"\r\n        Invoke-Command @icmParam\r\n     }\r\n     Catch {\r\n        Write-Warning \"Failed to run Invoke-Command\"\r\n        Write-Warning $myErr.ErrorRecord\r\n     }\r\n    \r\n} #process\r\n\r\nEnd {\r\n    Write-Verbose -Message \"Ending $($MyInvocation.Mycommand)\"\r\n} #end\r\n\r\n\r\n} #close function Get-RecentEventLog\r\n<\/pre>\n<p>The function works and took a about 1 1\/2 min to query 8 machines in my virtual test environment. There is definitely some overhead when using Invoke-Command, but the trade off is a script that is a little easier to develop and maintain. <\/p>\n<p>Then I thought, what about a workflow? I'm querying event logs but there's no reason I can't query all of them simultaneously. Here's my workflow that does essentially the same thing as my function.<\/p>\n<pre class=\"lang:ps decode:true \" >WorkFlow Get-RecentEventLog {\r\n\r\nParam(\r\n[int]$Days=1\r\n)\r\n\r\nWrite-Verbose -Message \"$(Get-Date) Starting $workflowcommandname\"\r\n\r\n#get event logs that have values\r\n$logs = Get-Eventlog -List | Where-Object -filter {$_.entries.count -gt 0}\r\n\r\n#search each log in parallel\r\nforeach -parallel ($log in $logs) {\r\n  Write-Verbose -message \"Processing $($log.log)\"\r\n  Sequence {\r\n   $After= InlineScript { (Get-Date).AddDays(-$using:Days).Date}\r\n   $EntryType= \"error\",\"warning\",\"failureaudit\"  \r\n   Try {\r\n    Get-Eventlog -LogName $log.log -After $After -EntryType $EntryType -ErrorAction Stop |\r\n    Add-Member -MemberType NoteProperty -Name Logname -value $log -PassThru\r\n   }\r\n   Catch {\r\n    Write-Verbose -Message \"No matching entries found in $($log.log)\"\r\n   }\r\n  } #sequence\r\n} #foreach parallel\r\n\r\nWrite-Verbose -Message \"$(Get-Date) Ending $workflowcommandname\"\r\n\r\n}<\/pre>\n<p>Interestingly, in my tests the workflow took about the same amount of time to run. But this is a shorter script to develop because all of the features like remoting, credentials and jobs are automatically part of the workflow. There is a potential downside in that all the remote machines must be running PowerShell 3.0. This workflow is also a great example in that workflows aren't always the answer. There's nothing really here, other than potentially the use of parallelism, that makes this a better choice than my function.<\/p>\n<p>My last concern with the gallery script, and I don't know if this would have an effect on its performance, is that all the event logs are rolled up in a property for each computer. This means you have to take some further steps to expand and format the results. My function and workflow, because they rely on Get-Eventlog, are formatted and ready to go.<\/p>\n<p>What I haven't tried yet, is how this same task can be done with Get-WinEvent or Get-CimInstance. The latter helps avoid some of the issues with WMI and might perform better. If I have time, I'll get back to you with my results. But in the meantime, what do you think about all of this? <\/p>\n<p>Using runspaces in PowerShell has a place, but definitely requires an advanced skill set and a willingness to accept a tradeoff of a more complicated script to develop and maintain (especially if someone else has to) with improved performance. I can see where using a runspace approach makes sense when you have 1000s of computers. But I might also argue that if that is your environment, you probably have full-blown management suites. Yes, I know there will always be exceptions. But for the majority of you, are you happy writing scripts that use existing cmdlets or do you feel obligated to learn .NET before you can use PowerShell?<\/p>\n<p>UPDATE:<br \/>\nI tried this using Get-CIMInstance. Yes, this requires PowerShell 3 remotely (unless you take an extra step to setup a DCOM CIM session) and the use of the WSMan protocol, but this performs suprisingly well and only takes a few lines of PowerShell.<\/p>\n<pre class=\"lang:ps decode:true \" >#convert date time to WMI format\r\n$after = [System.Management.ManagementDateTimeConverter]::ToDmtfDateTime((Get-Date).AddDays(-1).date)\r\n\r\n#get all non information and success entries\r\n$filter = \"TimeGenerated &gt;= \"\"$after\"\" AND (Type &lt;&gt; 'Information' AND type &lt;&gt; 'Audit Success')\"\r\n\r\n$computers = \"chi-dc01\",\"chi-dc04\",\"chi-hvr2\",\"chi-core01\",\"chi-win81\",\"chi-fp02\"\r\nGet-CimInstance win32_ntlogevent -filter $filter -ComputerName $computers<\/pre>\n<p>I ran this in my test environment and it took about 30 seconds to return 188 event log entries. Because we're using WSMAN we avoid some of the issues with RPC and DCOM. So here is a solution, at least in this case, that is as fast as using runspaces but only took a few minutes to write and is easy to follow. <\/p>\n<p>Everything we do as IT Pros is a matter of balancing trade-offs and working within a set of limitations.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The other day on Twitter I saw a message about new script in the Microsoft Script Center on getting remote event logs with WMI. So I took a look at the script. If you take a minute to look at the script you&#8217;ll quickly realize this is not a script for beginners. My initial thought&#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":"Fresh blogging: #PowerShell Runspaces, Remoting and Workflow, Oh My!","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,359,8,407,19],"tags":[534,87,540,547,382],"class_list":["post-3504","post","type-post","status-publish","format-standard","hentry","category-powershell","category-powershell-3-0","category-scripting","category-windows-server-2012","category-wmi","tag-powershell","tag-remoting","tag-scripting","tag-wmi","tag-workflow"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Runspaces, Remoting and Workflow, Oh My! &#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\/3504\/runspaces-remoting-and-workflow-oh-my\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Runspaces, Remoting and Workflow, Oh My! &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"The other day on Twitter I saw a message about new script in the Microsoft Script Center on getting remote event logs with WMI. So I took a look at the script. If you take a minute to look at the script you&#039;ll quickly realize this is not a script for beginners. My initial thought...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2013-10-18T14:29:27+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2013-10-18T16:22:57+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.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=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3504\\\/runspaces-remoting-and-workflow-oh-my\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3504\\\/runspaces-remoting-and-workflow-oh-my\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Runspaces, Remoting and Workflow, Oh My!\",\"datePublished\":\"2013-10-18T14:29:27+00:00\",\"dateModified\":\"2013-10-18T16:22:57+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3504\\\/runspaces-remoting-and-workflow-oh-my\\\/\"},\"wordCount\":778,\"commentCount\":9,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3504\\\/runspaces-remoting-and-workflow-oh-my\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/10\\\/talkbubble.png\",\"keywords\":[\"PowerShell\",\"remoting\",\"Scripting\",\"WMI\",\"Workflow\"],\"articleSection\":[\"PowerShell\",\"Powershell 3.0\",\"Scripting\",\"Windows Server 2012\",\"WMI\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3504\\\/runspaces-remoting-and-workflow-oh-my\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3504\\\/runspaces-remoting-and-workflow-oh-my\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3504\\\/runspaces-remoting-and-workflow-oh-my\\\/\",\"name\":\"Runspaces, Remoting and Workflow, Oh My! &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3504\\\/runspaces-remoting-and-workflow-oh-my\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3504\\\/runspaces-remoting-and-workflow-oh-my\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/10\\\/talkbubble.png\",\"datePublished\":\"2013-10-18T14:29:27+00:00\",\"dateModified\":\"2013-10-18T16:22:57+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3504\\\/runspaces-remoting-and-workflow-oh-my\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3504\\\/runspaces-remoting-and-workflow-oh-my\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3504\\\/runspaces-remoting-and-workflow-oh-my\\\/#primaryimage\",\"url\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/10\\\/talkbubble.png\",\"contentUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2011\\\/10\\\/talkbubble.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/3504\\\/runspaces-remoting-and-workflow-oh-my\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Runspaces, Remoting and Workflow, Oh My!\"}]},{\"@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":"Runspaces, Remoting and Workflow, Oh My! &#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\/3504\/runspaces-remoting-and-workflow-oh-my\/","og_locale":"en_US","og_type":"article","og_title":"Runspaces, Remoting and Workflow, Oh My! &#8226; The Lonely Administrator","og_description":"The other day on Twitter I saw a message about new script in the Microsoft Script Center on getting remote event logs with WMI. So I took a look at the script. If you take a minute to look at the script you'll quickly realize this is not a script for beginners. My initial thought...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/","og_site_name":"The Lonely Administrator","article_published_time":"2013-10-18T14:29:27+00:00","article_modified_time":"2013-10-18T16:22:57+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Runspaces, Remoting and Workflow, Oh My!","datePublished":"2013-10-18T14:29:27+00:00","dateModified":"2013-10-18T16:22:57+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/"},"wordCount":778,"commentCount":9,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.png","keywords":["PowerShell","remoting","Scripting","WMI","Workflow"],"articleSection":["PowerShell","Powershell 3.0","Scripting","Windows Server 2012","WMI"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/","name":"Runspaces, Remoting and Workflow, Oh My! &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.png","datePublished":"2013-10-18T14:29:27+00:00","dateModified":"2013-10-18T16:22:57+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/#primaryimage","url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.png","contentUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2011\/10\/talkbubble.png"},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3504\/runspaces-remoting-and-workflow-oh-my\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Runspaces, Remoting and Workflow, Oh My!"}]},{"@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":1454,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/1454\/teched-atlanta-managing-the-registry-with-powershell\/","url_meta":{"origin":3504,"position":0},"title":"TechEd Atlanta &#8211; Managing the Registry with PowerShell","author":"Jeffery Hicks","date":"May 23, 2011","format":false,"excerpt":"My second TechEd talk was about managing the registry with Windows PowerShell. If you were in the session you know that I stressed heavily using the PowerShell provider and cmdlets. For remote computers, leverage PowerShell's remoting infrastructure. But I also discussed using the \"raw\" .NET classes as well as WMI\u2026","rel":"","context":"In &quot;Conferences&quot;","block_context":{"text":"Conferences","link":"https:\/\/jdhitsolutions.com\/blog\/category\/conferences\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2809,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/","url_meta":{"origin":3504,"position":1},"title":"PowerShell Morning Report with Credentials","author":"Jeffery Hicks","date":"February 22, 2013","format":false,"excerpt":"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\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"morning report","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.png?resize=525%2C300 1.5x"},"classes":[]},{"id":3661,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/3661\/creating-cim-scripts-without-scripting\/","url_meta":{"origin":3504,"position":2},"title":"Creating CIM Scripts without Scripting","author":"Jeffery Hicks","date":"January 29, 2014","format":false,"excerpt":"When Windows 8 and Windows Server 2012 came out, along with PowerShell 3.0, we got our hands on some terrific technology in the form of the CIM cmdlets. Actually, we got much more than people realize. One of the reasons there was a big bump in the number of shipping\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":3504,"position":3},"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":2848,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2848\/wmi-explorer-from-the-powershell-guy\/","url_meta":{"origin":3504,"position":4},"title":"WMI Explorer from The PowerShell Guy","author":"Jeffery Hicks","date":"March 8, 2013","format":false,"excerpt":"Several years ago, The PowerShell Guy, aka MoW, wrote a fantastic graphical PowerShell script that was a WMI Explorer. With this script you could connect to a computer and namespace, browse classes and view instances. A great way for discovering things about WMI. However Marc has moved on to other\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"wmibrowser","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/03\/wmibrowser-1024x552.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/03\/wmibrowser-1024x552.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/03\/wmibrowser-1024x552.png?resize=525%2C300 1.5x"},"classes":[]},{"id":615,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/615\/remote-powershell-performance-comparison\/","url_meta":{"origin":3504,"position":5},"title":"Remote PowerShell Performance Comparison","author":"Jeffery Hicks","date":"April 5, 2010","format":false,"excerpt":"Fellow Windows PowerShell MVP Marco Shaw clued me in on a Microsoft blog post that did a terrific job of comparing, from a performance perspective the different PowerShell 2.0 techniques you can use when managing remote computers. The results are pretty much as I would expect. Cmdlets with a \u2013computername\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":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3504","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=3504"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/3504\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=3504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=3504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=3504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}