{"id":4048,"date":"2014-09-26T16:20:45","date_gmt":"2014-09-26T20:20:45","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=4048"},"modified":"2014-09-26T16:20:45","modified_gmt":"2014-09-26T20:20:45","slug":"friday-fun-pick-up-milk","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/","title":{"rendered":"Friday Fun: Pick Up Milk"},"content":{"rendered":"<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/09\/sticky-graphic.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignleft size-thumbnail wp-image-4049\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/09\/sticky-graphic-150x150.jpg\" alt=\"sticky-graphic\" width=\"150\" height=\"150\" \/><\/a> Sometimes when working on a PowerShell problem, you might have to come to the conclusion that PowerShell is not the right tool for the job. There are some tasks or applications that simply don't lend themselves to automation or PowerShell. This isn't necessarily a limitation in PowerShell, nor would I say it is a deficiency in the application at hand. It is just the nature of IT.<\/p>\n<p>That said, there may be situations where you still want to use PowerShell, even if the experience is less than optimal. So let's have some fun with this today. For a number of versions of Windows client's there has been a little utility called Sticky Notes.<br \/>\n<a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/09\/new-stickynote.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/09\/new-stickynote-300x205.jpg\" alt=\"new-stickynote\" width=\"300\" height=\"205\" class=\"aligncenter size-medium wp-image-4050\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/09\/new-stickynote-300x205.jpg 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/09\/new-stickynote.jpg 544w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>This is an electronic version of Post-It Notes. Wouldn't it be nice to be able to use PowerShell to take advantage of the utility? Sadly, this application is written in such a way that nothing is exposed that can be automated, either through COM or .NET. So we're left with a drastic measure of sending keys to the application.<\/p>\n<p>As in the days of VBScript, sending keys is a risky proposition because you can't always guarantee that the application in question will have focus. But let's try. First, we need to start the program simply by invoking the command stikynot. <\/p>\n<p>To send keys I'm going to use the .NET Framework. So to be on the safe side, I'm going to add some necessary assemblies just in case. It won't matter if they are already loaded.<\/p>\n<pre class=\"lang:ps decode:true \" >[void] [System.Reflection.Assembly]::LoadWithPartialName(\"'Microsoft.VisualBasic\")\r\n[void] [System.Reflection.Assembly]::LoadWithPartialName(\"'System.Windows.Forms\")<\/pre>\n<p>Now to activate the window. You can do this by the window title. <\/p>\n<pre class=\"lang:batch decode:true \" >PS D:\\temp&gt; get-process stikynot | select mainwindowtitle\r\n\r\nMainWindowTitle\r\n---------------\r\nSticky Notes<\/pre>\n<p>Or the process ID. I'll use the title.<\/p>\n<pre class=\"lang:ps decode:true \" >[Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")<\/pre>\n<p>While the window has focus, I can send keys to it. <\/p>\n<pre class=\"lang:ps decode:true \" >[System.Windows.Forms.SendKeys]::SendWait(\"Get milk\")\r\n<\/pre>\n<p>And that's all there is to it! Sticky Notes have a number of keyboard shortcuts you can send using this technique. I found a page at <a href=\"http:\/\/www.door2windows.com\/list-of-all-keyboard-shortcuts-for-sticky-notes-in-windows-7\/\" target=\"_blank\">http:\/\/www.door2windows.com\/list-of-all-keyboard-shortcuts-for-sticky-notes-in-windows-7\/<\/a> that listed many of them.<\/p>\n<p>But you know I'm not going to stop here. I built a module called StickyNotes.<\/p>\n<pre class=\"lang:ps decode:true \" >#requires -version 3.0\r\n\r\n#StickyNotes.psm1\r\n\r\n&lt;#\r\na set of functions for using Sticky Notes in Windows\r\n\r\nLearn more:\r\n PowerShell in Depth: An Administrator's Guide (http:\/\/www.manning.com\/jones6\/)\r\n PowerShell Deep Dives (http:\/\/manning.com\/hicks\/)\r\n Learn PowerShell in a Month of Lunches (http:\/\/manning.com\/jones3\/)\r\n Learn PowerShell Toolmaking in a Month of Lunches (http:\/\/manning.com\/jones4\/)\r\n \r\n\r\n  ****************************************************************\r\n  * DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED *\r\n  * THOROUGHLY IN A LAB ENVIRONMENT. USE AT YOUR OWN RISK.  IF   *\r\n  * YOU DO NOT UNDERSTAND WHAT THIS SCRIPT DOES OR HOW IT WORKS, *\r\n  * DO NOT USE IT OUTSIDE OF A SECURE, TEST SETTING.             *\r\n  ****************************************************************\r\n\r\n#&gt;\r\n\r\n\r\n#load necessary assemblies just in case\r\n[void] [System.Reflection.Assembly]::LoadWithPartialName(\"'Microsoft.VisualBasic\")\r\n[void] [System.Reflection.Assembly]::LoadWithPartialName(\"'System.Windows.Forms\")\r\n\r\n#sleep interval to allow stikynot process to start\r\n$sleep = 150\r\n\r\n#private function for formatting the note\r\n\r\nFunction _FormatNote {\r\n\r\n[cmdletbinding(DefaultParameterSetName=\"__AllParameterSets\")]\r\n\r\nParam(\r\n[string]$Text,\r\n[switch]$Bold,\r\n[switch]$Italic,\r\n[switch]$Underline,\r\n[Parameter(ParameterSetName=\"Center\")]\r\n[switch]$Center,\r\n[Parameter(ParameterSetName=\"Right\")]\r\n[switch]$Right,\r\n[switch]$Append\r\n)\r\n\r\nWrite-verbose \"Activating note\"\r\n#grab the program\r\n[Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")\r\n\r\n#add formatting\r\nif ($Bold) {\r\n    [Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")\r\n    [System.Windows.Forms.SendKeys]::SendWait(\"^b\")\r\n}\r\nif ($Italic) {\r\n    [Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")\r\n    [System.Windows.Forms.SendKeys]::SendWait(\"^i\")\r\n}\r\nif ($Underline) {\r\n    [Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")\r\n    [System.Windows.Forms.SendKeys]::SendWait(\"^u\")\r\n}\r\nif ($Center) {\r\n    [Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")\r\n    [System.Windows.Forms.SendKeys]::SendWait(\"^e\")\r\n}\r\nif ($Right) {\r\n    [Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")\r\n    [System.Windows.Forms.SendKeys]::SendWait(\"^r\")\r\n}\r\n\r\nif ($append) {\r\n    #jump to the end of existing text\r\n    Write-verbose \"Appending\"\r\n    [Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")\r\n    [System.Windows.Forms.SendKeys]::SendWait(\"{Down}\")\r\n} \r\n\r\n#send the text\r\nif ($text) {\r\n #copy text to clipboard and paste it. Faster than trying to send keys\r\n $text | clip\r\n  [Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")\r\n  [System.Windows.Forms.SendKeys]::SendWait(\"^v\")\r\n  [Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")\r\n  #give the paste a moment to complete\r\n  start-sleep -Milliseconds 50\r\n  [System.Windows.Forms.SendKeys]::SendWait(\"{Enter}\")\r\n \r\n \r\n} #if $text\r\n\r\n[Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")\r\nStart-Sleep -Milliseconds 50\r\n[System.Windows.Forms.SendKeys]::SendWait(\"{Down}\")\r\n\r\nWrite-Verbose \"Finished formatting note\"\r\n} #end private function\r\n\r\nFunction New-StickyNote {\r\n\r\n&lt;#\r\n.Synopsis\r\nCreate a new sticky note.\r\n.Description\r\nThis command will create a new sticky note. You can specify additional formatting options.\r\n.Parameter Center\r\nAlign text center. The default is left.\r\n.Parameter Right\r\nAlign text right. The default is left.\r\n.Example\r\nPS C:\\&gt; new-stickynote \"pickup milk on the way home\" -bold\r\n.Notes\r\nLast Updated: Sept. 25, 2014\r\nVersion     : 0.9\r\n\r\n#&gt;\r\n\r\n[cmdletbinding(DefaultParameterSetName=\"__AllParameterSets\")]\r\nParam(\r\n[Parameter(position=0,Mandatory=$True,HelpMessage=\"Enter text for the sticky note\")]\r\n[string]$Text,\r\n[switch]$Bold,\r\n[switch]$Italic,\r\n[switch]$Underline,\r\n[Parameter(ParameterSetName=\"Center\")]\r\n[switch]$Center,\r\n[Parameter(ParameterSetName=\"Right\")]\r\n[switch]$Right\r\n)\r\n\r\nWrite-Verbose \"Starting $($MyInvocation.MyCommand)\"\r\n\r\n#if Sticky Note is already running switch to Add-StickyNote\r\n\r\n$proc = Get-Process -Name stikynot -ErrorAction SilentlyContinue\r\nif ($proc) {\r\n  Write-Verbose \"Sticky Note already running. Calling Add-StickyNote\"\r\n  Add-StickyNote @PSBoundParameters\r\n  #bail out of this function\r\n  Return\r\n}\r\nelse {\r\n#start the program\r\nTry {\r\n    Write-Verbose \"Starting new process\"\r\n    Start-Process stikynot\r\n    #give it a moment to complete\r\n    Write-Verbose \"Sleeping $sleep ms\"\r\n    Start-Sleep -Milliseconds $sleep\r\n}\r\ncatch {\r\n    Throw\r\n}\r\n\r\n} #if $proc\r\n\r\n#format the note\r\n_FormatNote @PSBoundParameters\r\n\r\n#return focus to originating app\r\n[Microsoft.VisualBasic.Interaction]::AppActivate($pid)\r\n\r\nWrite-Verbose \"Ending $($MyInvocation.MyCommand)\"\r\n} #end function\r\n\r\nFunction Add-StickyNote {\r\n\r\n&lt;#\r\n.Synopsis\r\nAdd a new sticky note.\r\n.Description\r\nThis command will create a add sticky note. You can specify additional formatting options. If there are no existing sticky notes, this command will create one.\r\n.Parameter Center\r\nAlign text center. The default is left.\r\n.Parameter Right\r\nAlign text right. The default is left.\r\n.Example\r\nPS C:\\&gt; add-stickynote \"pickup milk on the way home\" -bold\r\n.Notes\r\nLast Updated: Sept. 25, 2014\r\nVersion     : 0.9\r\n\r\n#&gt;\r\n\r\n[cmdletbinding(DefaultParameterSetName=\"__AllParameterSets\")]\r\nParam(\r\n[Parameter(position=0,Mandatory=$True,HelpMessage=\"Enter text for the sticky note\")]\r\n[string]$Text,\r\n[switch]$Bold,\r\n[switch]$Italic,\r\n[switch]$Underline,\r\n[Parameter(ParameterSetName=\"Center\")]\r\n[switch]$Center,\r\n[Parameter(ParameterSetName=\"Right\")]\r\n[switch]$Right\r\n)\r\n\r\nWrite-Verbose \"Starting $($MyInvocation.MyCommand)\"\r\n\r\n#start the program if not running\r\nTry {\r\n    if (-Not (Get-Process -Name stikynot -ErrorAction SilentlyContinue)) {\r\n        Write-Verbose \"Starting Sticky Note\"\r\n        Start-Process stikynot\r\n        #give it a moment to complete\r\n         Write-Verbose \"Sleeping $sleep ms\"\r\n        Start-Sleep -Milliseconds $sleep\r\n       $Existing = $False\r\n    }\r\n    else {\r\n         #create a flag to know that I can use an existing process\r\n         Write-Verbose \"Re-using existing Sticky Note Process\"\r\n        $Existing = $True\r\n    }\r\n        #grab the program\r\n        [Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")\r\n   \r\n}\r\ncatch {\r\n    Throw\r\n}\r\n\r\nIf ($Existing) {\r\n    #Add a new note\r\n    Write-Verbose \"Add a new note\"\r\n    [System.Windows.Forms.SendKeys]::SendWait(\"^n\")\r\n    Start-sleep -Milliseconds $sleep\r\n}\r\n\r\n#format the note\r\n_FormatNote @PSBoundParameters\r\n\r\n#return focus to originating app\r\n[Microsoft.VisualBasic.Interaction]::AppActivate($pid)\r\n\r\nWrite-Verbose \"Ending $($MyInvocation.MyCommand)\"\r\n\r\n\r\n} #end function\r\n\r\nFunction Set-StickyNote {\r\n\r\n&lt;#\r\n.Synopsis\r\nSet text and style for a sticky note.\r\n.Description\r\nThis command will set the text and style for a sticky note. If there are multiple notes, this command will set the one that has focus, which you must do manually. The default is the last note created.\r\n\r\nThe style parameters like Bold behave more like toggles. If text is already in bold than using -Bold will turn it off and vice versa.\r\n.Parameter Center\r\nAlign text center. The default is left.\r\n.Parameter Right\r\nAlign text right. The default is left.\r\n.Parameter Append\r\nAppend your text to the end of the note. Otherwise existing text will be replaced\r\n.Example\r\nPS C:\\&gt; set-stickynote \"pickup milk on the way home\" -bold -underline -append\r\n.Notes\r\nLast Updated: Sept. 25, 2014\r\nVersion     : 0.9\r\n\r\n#&gt;\r\n\r\n[cmdletbinding(DefaultParameterSetName=\"__AllParameterSets\")]\r\nParam(\r\n[Parameter(position=0)]\r\n[string]$Text,\r\n[switch]$Bold,\r\n[switch]$Italic,\r\n[switch]$Underline,\r\n[Parameter(ParameterSetName=\"Center\")]\r\n[switch]$Center,\r\n[Parameter(ParameterSetName=\"Right\")]\r\n[switch]$Right,\r\n[switch]$Append\r\n)\r\n\r\nWrite-Verbose \"Starting $($MyInvocation.MyCommand)\"\r\n\r\n#start the program if not running\r\nTry {\r\n     #grab the program\r\n     [Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")\r\n    #select existing text\r\n    [System.Windows.Forms.SendKeys]::SendWait(\"^a\")\r\n}\r\ncatch {\r\n    Throw\r\n}\r\n\r\n#format the note\r\n_FormatNote @PSBoundParameters\r\n\r\n#return focus to originating app\r\n[Microsoft.VisualBasic.Interaction]::AppActivate($pid)\r\n\r\nWrite-Verbose \"Ending $($MyInvocation.MyCommand)\"\r\n\r\n\r\n} #end function\r\n\r\nFunction Remove-StickyNote {\r\n\r\n&lt;#\r\n.Synopsis\r\nRemove a new sticky note.\r\n.Description\r\nThis command will remove the sticky note that has focus. If you have more than one note, the last one created has focus, unless you manually select a different one.\r\n\r\nIf you kill the stikynot process, the next time you create a note, any previously created notes will return.\r\n\r\n.Example\r\nPS C:\\&gt; remove-stickynote \r\n\r\n.Notes\r\nLast Updated: Sept. 25, 2014\r\nVersion     : 0.9\r\n\r\n#&gt;\r\n\r\n[cmdletbinding(SupportsShouldProcess)]\r\nParam()\r\n\r\nWrite-Verbose \"Starting $($MyInvocation.MyCommand)\"\r\n\r\n$proc= Get-Process stikynot -ErrorAction Stop\r\nif ($proc) {\r\n    #grab the program\r\n    [Microsoft.VisualBasic.Interaction]::AppActivate(\"Sticky Notes\")\r\n    if ($PSCmdlet.ShouldProcess(($proc| Out-String).Trim())) {\r\n        [System.Windows.Forms.SendKeys]::SendWait(\"^d\")\r\n    } #whatif\r\n}\r\nelse {\r\n    Write-Verbose \"No sticky notes seem to be running\"\r\n}\r\n\r\n#return focus to originating app\r\n[Microsoft.VisualBasic.Interaction]::AppActivate($pid)\r\n\r\nWrite-Verbose \"Ending $($MyInvocation.MyCommand)\"\r\n\r\n\r\n} #end function\r\n\r\n#define aliases\r\nSet-Alias -Name rn -Value Remove-StickyNote\r\nSet-Alias -Name an -Value Add-StickyNote\r\nSet-Alias -Name sn -Value Set-StickyNote\r\nSet-Alias -Name nn -Value New-StickyNote\r\n\r\nExport-ModuleMember -Alias * -Function \"*-StickyNote\"<\/pre>\n<p>The module includes several functions for creating, adding, setting and removing sticky notes. The tricky part was getting the timing right. You might need to adjust some sleep values, or be prepared to re-run a command. I would not build any mission critical processes around anything that uses send keys techniques as it isn't reliable. But it sure is fun!<\/p>\n<p>You might even use it like this: <\/p>\n<pre class=\"lang:ps decode:true \" >start-job { \r\n$paramHash = @{\r\n LogName = \"System\"\r\n newest = 10\r\n ComputerName = \"chi-dc01\",\"chi-dc02\",\"chi-dc04\",\"chi-core01\",\"chi-hvr2\"\r\n EntryType = \"Error\",\"warning\"\r\n}\r\n\r\nGet-EventLog @paramHash\r\nNew-StickyNote \"The event log job has completed\" -Bold\r\n\r\n} <\/pre>\n<p>At the end of the command, a sticky note pops up letting you know the deed is done. You might see an error about a missing process, but you can ignore it. Or maybe you simply need a reminder to pickup that loaf of bread or your child on the way home.<\/p>\n<p>Sometimes PowerShell isn't the best tool for the job, but I think it can always be fun. Let me know what you think of my little project.<\/p>\n<p>Have a great weekend.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes when working on a PowerShell problem, you might have to come to the conclusion that PowerShell is not the right tool for the job. There are some tasks or applications that simply don&#8217;t lend themselves to automation or PowerShell. This isn&#8217;t necessarily a limitation in PowerShell, nor would I say it is a deficiency&#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 Friday Fun: Pick Up Milk 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":[271,4],"tags":[568,534,540],"class_list":["post-4048","post","type-post","status-publish","format-standard","hentry","category-friday-fun","category-powershell","tag-friday-fun","tag-powershell","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Friday Fun: Pick Up Milk &#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\/4048\/friday-fun-pick-up-milk\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Friday Fun: Pick Up Milk &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Sometimes when working on a PowerShell problem, you might have to come to the conclusion that PowerShell is not the right tool for the job. There are some tasks or applications that simply don&#039;t lend themselves to automation or PowerShell. This isn&#039;t necessarily a limitation in PowerShell, nor would I say it is a deficiency...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2014-09-26T20:20:45+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/09\/sticky-graphic-150x150.jpg\" \/>\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=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4048\\\/friday-fun-pick-up-milk\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4048\\\/friday-fun-pick-up-milk\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Friday Fun: Pick Up Milk\",\"datePublished\":\"2014-09-26T20:20:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4048\\\/friday-fun-pick-up-milk\\\/\"},\"wordCount\":503,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4048\\\/friday-fun-pick-up-milk\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/sticky-graphic-150x150.jpg\",\"keywords\":[\"Friday Fun\",\"PowerShell\",\"Scripting\"],\"articleSection\":[\"Friday Fun\",\"PowerShell\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4048\\\/friday-fun-pick-up-milk\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4048\\\/friday-fun-pick-up-milk\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4048\\\/friday-fun-pick-up-milk\\\/\",\"name\":\"Friday Fun: Pick Up Milk &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4048\\\/friday-fun-pick-up-milk\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4048\\\/friday-fun-pick-up-milk\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/sticky-graphic-150x150.jpg\",\"datePublished\":\"2014-09-26T20:20:45+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4048\\\/friday-fun-pick-up-milk\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4048\\\/friday-fun-pick-up-milk\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4048\\\/friday-fun-pick-up-milk\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/sticky-graphic.jpg\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2014\\\/09\\\/sticky-graphic.jpg\",\"width\":590,\"height\":506},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/4048\\\/friday-fun-pick-up-milk\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Friday Fun\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/friday-fun\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Friday Fun: Pick Up Milk\"}]},{\"@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":"Friday Fun: Pick Up Milk &#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\/4048\/friday-fun-pick-up-milk\/","og_locale":"en_US","og_type":"article","og_title":"Friday Fun: Pick Up Milk &#8226; The Lonely Administrator","og_description":"Sometimes when working on a PowerShell problem, you might have to come to the conclusion that PowerShell is not the right tool for the job. There are some tasks or applications that simply don't lend themselves to automation or PowerShell. This isn't necessarily a limitation in PowerShell, nor would I say it is a deficiency...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/","og_site_name":"The Lonely Administrator","article_published_time":"2014-09-26T20:20:45+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/09\/sticky-graphic-150x150.jpg","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":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Friday Fun: Pick Up Milk","datePublished":"2014-09-26T20:20:45+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/"},"wordCount":503,"commentCount":0,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/09\/sticky-graphic-150x150.jpg","keywords":["Friday Fun","PowerShell","Scripting"],"articleSection":["Friday Fun","PowerShell"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/","name":"Friday Fun: Pick Up Milk &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/09\/sticky-graphic-150x150.jpg","datePublished":"2014-09-26T20:20:45+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/09\/sticky-graphic.jpg","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2014\/09\/sticky-graphic.jpg","width":590,"height":506},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/4048\/friday-fun-pick-up-milk\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Friday Fun","item":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},{"@type":"ListItem","position":2,"name":"Friday Fun: Pick Up Milk"}]},{"@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":2880,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2880\/friday-fun-powershell-puzzlers\/","url_meta":{"origin":4048,"position":0},"title":"Friday Fun PowerShell Puzzlers","author":"Jeffery Hicks","date":"March 15, 2013","format":false,"excerpt":"This week's Friday Fun is a short PowerShell puzzler which I hope you'll have some fun with and maybe even lead you to look something up and how knows what that might lead to! The following scrambled terms are all PowerShell related. The ones asterisked are PowerShell 3.0 related, but\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"letterjumble","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/03\/letterjumble-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":7134,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7134\/friday-fun-thank-god-its-a-powershell-friday\/","url_meta":{"origin":4048,"position":1},"title":"Friday Fun: Thank God It&#8217;s a PowerShell Friday","author":"Jeffery Hicks","date":"December 27, 2019","format":false,"excerpt":"Well here we are at the last Friday of the year. In fact , the last Friday of the decade! On this auspicious occasion, let's have some PowerShell fun and celebrate Friday. No matter what you call it, I'm assuming Friday is your last typical workday and something we look\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":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/12\/image_thumb-38.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/12\/image_thumb-38.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/12\/image_thumb-38.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/12\/image_thumb-38.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":6262,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6262\/revised-everything-powershell-prompt\/","url_meta":{"origin":4048,"position":2},"title":"Revised Everything PowerShell Prompt","author":"Jeffery Hicks","date":"December 7, 2018","format":false,"excerpt":"Since it is Friday and time for some more PowerShell fun, and I\u2019ve been sharing some of my prompt functions, I thought I\u2019d re-share my kitchen sink prompt. This PowerShell prompt function does *a lot* to things and gives you a snapshot view of your system everytime you press enter.\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":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/image_thumb-5.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/image_thumb-5.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/12\/image_thumb-5.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":5799,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5799\/friday-fun-a-long-time-ago-in-a-powershell-universe-far-far-away\/","url_meta":{"origin":4048,"position":3},"title":"Friday Fun: A Long Time Ago in a PowerShell Universe Far, Far Away","author":"Jeffery Hicks","date":"December 1, 2017","format":false,"excerpt":"With the upcoming release of the next Star Wars movie, I thought I would revisit my PowerShell script that generates your Star Wars universe name. Sure, it is contrived and completely impractical, but I'm betting you are curious nonetheless. My previous version as a simple script with hard coded values\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":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/12\/image_thumb.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/12\/image_thumb.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/12\/image_thumb.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/12\/image_thumb.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":4923,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-ise\/4923\/friday-fun-tweaking-the-powershell-ise\/","url_meta":{"origin":4048,"position":4},"title":"Friday Fun: Tweaking the PowerShell ISE","author":"Jeffery Hicks","date":"February 19, 2016","format":false,"excerpt":"Today's fun is still PowerShell related, but instead of something in the console, we'll have some fun with the PowerShell ISE. One of the things I love about the PowerShell ISE is that you can customize it and extend it.\u00a0 My ISE Scripting Geek project is an example.\u00a0 But today\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-12.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":2962,"url":"https:\/\/jdhitsolutions.com\/blog\/friday-fun\/2962\/friday-fun-powershell-commands-by-noun\/","url_meta":{"origin":4048,"position":5},"title":"Friday Fun PowerShell Commands by Noun","author":"Jeffery Hicks","date":"April 19, 2013","format":false,"excerpt":"One of PowerShell's greatest strength's is discoverability. Once you know how, it is very easy to discover what \u00a0you can do with PowerShell and how. One reason this works is because PowerShell commands follow a consistent verb-noun naming convention. With this in mind, you can see all of the commands\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"get-command-noun-01","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-command-noun-01-1024x577.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-command-noun-01-1024x577.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/04\/get-command-noun-01-1024x577.png?resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4048","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=4048"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/4048\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=4048"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=4048"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=4048"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}