{"id":8241,"date":"2021-03-23T13:06:15","date_gmt":"2021-03-23T17:06:15","guid":{"rendered":"https:\/\/jdhitsolutions.com\/blog\/?p=8241"},"modified":"2021-03-23T13:06:20","modified_gmt":"2021-03-23T17:06:20","slug":"cleaning-with-powershell-revisited","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/","title":{"rendered":"Cleaning with PowerShell Revisited"},"content":{"rendered":"\n<div class=\"wp-block-image is-style-default\"><figure class=\"alignleft size-large\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/pexels-furkanfdemir-5816569.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"160\" height=\"213\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/pexels-furkanfdemir-5816569.jpg\" alt=\"\" class=\"wp-image-8242\"\/><\/a><\/figure><\/div>\n\n\n\n<p>Springtime is approaching in North America. Where I live, the snow has finally melted and we have blue skies with warmer temperatures. Of course, this means Spring Cleaning. Time to clear out the winter debris and spruce up the house. For me, this is also a good time for some computing housecleaning as well. I don't know about your Windows environment, but I tend to accumulate a lot of junk. Most of the time I don't see it, but I know it's there. While the junk normally doesn't have a negative impact, I think mentally, I like clearing things out and tidying up. So I pulled out some older PowerShell code, freshened it up, and now I have a set of tools for clearing out junk and temporary folders. Let me show you what I came up with.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Remove Old Files<\/h2>\n\n\n\n<p>The first task is to delete files that are older than a given date. I typically want to clean out files from my temp folders. I know that some of these files might still be in use so I don't necessarily want to broadly delete all files. I want to only delete files where the last modified date is older than a given date. Eventually, I will use the last boot up time. Any file older than the last boot up time, should  be safe to delete from any temp folder. Here's my PowerShell function.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Function\u00a0Remove-File\u00a0{\n\u00a0\u00a0\u00a0\u00a0[cmdletbinding(SupportsShouldProcess)]\n\u00a0\u00a0\u00a0\u00a0[Alias(\"rfi\")]\n\u00a0\u00a0\u00a0\u00a0Param(\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[Parameter(Position\u00a0=\u00a00)]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[ValidateScript(\u00a0{\u00a0Test-Path\u00a0$_\u00a0})]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[string]$Path\u00a0=\u00a0$env:temp,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[Parameter(Position\u00a0=\u00a01,\u00a0Mandatory,\u00a0HelpMessage\u00a0=\u00a0\"Enter\u00a0a\u00a0cutoff\u00a0date.\u00a0All\u00a0files\u00a0modified\u00a0BEFORE\u00a0this\u00a0date\u00a0will\u00a0be\u00a0removed.\")]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[ValidateScript(\u00a0{\u00a0$_\u00a0-lt\u00a0(Get-Date)\u00a0})]\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[datetime]$Cutoff,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[Switch]$Recurse,\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[Switch]$Force\n\u00a0\u00a0\u00a0\u00a0)\n\n\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Starting\u00a0$($MyInvocation.MyCommand)\"\n\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Removing\u00a0files\u00a0in\u00a0$path\u00a0older\u00a0than\u00a0$cutoff\"\n\n\u00a0\u00a0\u00a0\u00a0<em>#clean\u00a0up\u00a0PSBoundParameters\u00a0which\u00a0will\u00a0be\u00a0splatted\u00a0to\u00a0Get-ChildItem<\/em>\n\u00a0\u00a0\u00a0\u00a0[void]$PSBoundParameters.Add(\"File\",\u00a0$True)\n\u00a0\u00a0\u00a0\u00a0[void]$PSBoundParameters.Remove(\"CutOff\")\n\u00a0\u00a0\u00a0\u00a0if\u00a0($WhatIfPreference)\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0[void]$PSBoundParameters.Remove(\"Whatif\")\n\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Using\u00a0these\u00a0parameters:\u00a0`n\u00a0$($PSBoundParameters\u00a0|\u00a0Out-String)\"\n\u00a0\u00a0\u00a0\u00a0Try\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$files\u00a0=\u00a0Get-ChildItem\u00a0@PSBoundParameters\u00a0-ErrorAction\u00a0Stop\u00a0|\u00a0Where-Object\u00a0{\u00a0$_.lastwritetime\u00a0-lt\u00a0$cutoff\u00a0}\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0Catch\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Warning\u00a0\"Failed\u00a0to\u00a0enumerate\u00a0files\u00a0in\u00a0$path\"\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Warning\u00a0$_.Exception.Message\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<em>#Bail\u00a0out<\/em>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Return\n\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0if\u00a0($files)\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Found\u00a0$($files.count)\u00a0file(s)\u00a0to\u00a0delete.\"\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$stats\u00a0=\u00a0$files\u00a0|\u00a0Measure-Object\u00a0-Sum\u00a0length\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$msg\u00a0=\u00a0\"Removing\u00a0{0}\u00a0files\u00a0for\u00a0a\u00a0total\u00a0of\u00a0{1}\u00a0MB\u00a0({2}\u00a0bytes)\u00a0from\u00a0{3}.\"\u00a0-f\u00a0$stats.count,\u00a0($stats.sum\u00a0\/\u00a01MB\u00a0-as\u00a0[int]),\u00a0$stats.sum,\u00a0$path.toUpper()\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0$msg\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<em>#only\u00a0remove\u00a0files\u00a0if\u00a0anything\u00a0was\u00a0found<\/em>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$files\u00a0|\u00a0Remove-Item\u00a0-Force\n\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0<em>#Display\u00a0a\u00a0WhatIf\u00a0Summary<\/em>\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if\u00a0($WhatIfPreference)\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Host\u00a0\"What\u00a0if:\u00a0$msg\"\u00a0-ForegroundColor\u00a0CYAN\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0}\u00a0<em>#if\u00a0$files<\/em>\n\u00a0\u00a0\u00a0\u00a0else\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Warning\u00a0\"No\u00a0files\u00a0found\u00a0to\u00a0remove\u00a0in\u00a0$($path.ToUpper())\u00a0older\u00a0than\u00a0$Cutoff.\"\n\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Ending\u00a0$($MyInvocation.MyCommand)\"\n}\u00a0<em>#close\u00a0function<\/em><\/code><\/pre>\n\n\n\n<p>I have support for -WhatIf in cmdletbinding. I don't need to code anything special to use it. Remove-Item supports -WhatIf so if I run the function with the parameter, Remove-Item will automatically detect it.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/remove-file.png\"><img loading=\"lazy\" decoding=\"async\" width=\"813\" height=\"313\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/remove-file.png\" alt=\"\" class=\"wp-image-8243\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/remove-file.png 813w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/remove-file-300x115.png 300w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/remove-file-768x296.png 768w\" sizes=\"auto, (max-width: 813px) 100vw, 813px\" \/><\/a><\/figure>\n\n\n\n<p>My function has a snippet of code that gives me a summary of what the function would do. I even make it look like WhatIf output, except that I use Write-Host and display the message in Cyan so it stands out.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Remove Empty Directories<\/h2>\n\n\n\n<p>Next, I want to remove empty directories. I've written a variety of functions and scripts over the years to do this. Here's my current iteration.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">Function\u00a0Remove-EmptyFolder\u00a0{\n\u00a0\u00a0[cmdletbinding(SupportsShouldProcess)]\n\u00a0\u00a0[alias(\"ref\")]\n\u00a0\u00a0[outputType(\"None\")]\n\u00a0\u00a0Param(\n\u00a0\u00a0\u00a0\u00a0[Parameter(Position\u00a0=\u00a00,\u00a0Mandatory,\u00a0HelpMessage\u00a0=\u00a0\"Enter\u00a0a\u00a0root\u00a0directory\u00a0path\")]\n\u00a0\u00a0\u00a0\u00a0[ValidateScript(\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Try\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Convert-Path\u00a0-Path\u00a0$_\u00a0-ErrorAction\u00a0stop\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if\u00a0((Get-Item\u00a0$_).PSProvider.Name\u00a0-ne\u00a0'FileSystem')\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Throw\u00a0\"$_\u00a0is\u00a0not\u00a0a\u00a0file\u00a0system\u00a0path.\"\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$true\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Catch\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Warning\u00a0$_.exception.message\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Throw\u00a0\"Try\u00a0again.\"\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0})]\n\u00a0\u00a0\u00a0\u00a0[string]$Path\n\u00a0\u00a0)\n\n\u00a0\u00a0Write-Verbose\u00a0\"Starting\u00a0$($myinvocation.mycommand)\"\n\n\u00a0\u00a0Write-Verbose\u00a0\"Enumerating\u00a0folders\u00a0in\u00a0$Path\"\n\n\u00a0\u00a0$folders\u00a0=\u00a0(Get-Item\u00a0-Path\u00a0$Path\u00a0-force).EnumerateDirectories(\"*\",\u00a0[System.IO.SearchOption]::AllDirectories).foreach(\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if\u00a0($((Get-Item\u00a0$_.FullName\u00a0-force).EnumerateFiles(\"*\",\u00a0[System.IO.SearchOption]::AllDirectories)).count\u00a0-eq\u00a00)\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$_.fullname\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0})\n\n\u00a0\u00a0If\u00a0($folders.count\u00a0-gt\u00a00)\u00a0{\n\n\u00a0\u00a0\u00a0\u00a0$msg\u00a0=\u00a0\"Removing\u00a0$($folders.count)\u00a0empty\u00a0folder(s)\u00a0in\u00a0$($path.ToUpper())\"\n\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0$msg\n\u00a0\u00a0\u00a0\u00a0<em>#Test\u00a0each\u00a0path\u00a0to\u00a0make\u00a0sure\u00a0it\u00a0still\u00a0exists and\u00a0then\u00a0delete\u00a0it<\/em>\n\u00a0\u00a0\u00a0\u00a0foreach\u00a0($folder\u00a0in\u00a0$folders)\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0If\u00a0(Test-Path\u00a0-Path\u00a0$Folder)\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Removing\u00a0$folder\"\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Remove-Item\u00a0-Path\u00a0$folder\u00a0-Force\u00a0-Recurse\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0\u00a0\u00a0}\n\n\u00a0\u00a0\u00a0\u00a0<em>#Display\u00a0a\u00a0WhatIf\u00a0Summary<\/em>\n\u00a0\u00a0\u00a0\u00a0if\u00a0($WhatIfPreference)\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Host\u00a0\"What\u00a0if:\u00a0$msg\"\u00a0-ForegroundColor\u00a0CYAN\n\u00a0\u00a0\u00a0\u00a0}\n\u00a0\u00a0}\n\u00a0\u00a0else\u00a0{\n\u00a0\u00a0\u00a0\u00a0Write-Warning\u00a0\"No\u00a0empty\u00a0folders\u00a0found\u00a0under\u00a0$($path.ToUpper()).\"\n\u00a0\u00a0}\n\n\u00a0\u00a0Write-Verbose\u00a0\"Ending\u00a0$($myinvocation.mycommand)\"\n\n}\u00a0<em>#end\u00a0Remove-EmptyFolder<\/em><\/code><\/pre>\n\n\n\n<p>Instead of getting a child listing of each folder , I'm calling the EnumerateDirectories() and EnumerateFiles() methods. This appears to perform a bit faster. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$folders\u00a0=\u00a0(Get-Item\u00a0-Path\u00a0$Path\u00a0-force).EnumerateDirectories(\"*\",\u00a0[System.IO.SearchOption]::AllDirectories).foreach(\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0if\u00a0($((Get-Item\u00a0$_.FullName\u00a0-force).EnumerateFiles(\"*\",\u00a0[System.IO.SearchOption]::AllDirectories)).count\u00a0-eq\u00a00)\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0$_.fullname\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0}\u00a0})<\/code><\/pre>\n\n\n\n<p>The first part of this expression is getting all directories in the search path. Then I'm testing for any files in each folder. if there are no files, the full path to the empty directory is saved to $folders. This becomes the list of items to delete.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">foreach\u00a0($folder\u00a0in\u00a0$folders)\u00a0{\n\u00a0\u00a0\u00a0If\u00a0(Test-Path\u00a0-Path\u00a0$Folder)\u00a0{\n\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0Write-Verbose\u00a0\"Removing\u00a0$folder\"\n\u00a0\u00a0\u00a0\u00a0\u00a0Remove-Item\u00a0-Path\u00a0$folder\u00a0-Force\u00a0-Recurse\n\u00a0\u00a0\u00a0}\n}<\/code><\/pre>\n\n\n\n<p>I'm doing a quick test of each path because I may have already deleted an empty parent.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large is-style-default\"><a href=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/remove-empty.png\"><img loading=\"lazy\" decoding=\"async\" width=\"698\" height=\"149\" src=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/remove-empty.png\" alt=\"\" class=\"wp-image-8244\" srcset=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/remove-empty.png 698w, https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/remove-empty-300x64.png 300w\" sizes=\"auto, (max-width: 698px) 100vw, 698px\" \/><\/a><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Using a Control Script<\/h2>\n\n\n\n<p>While I can run the functions separately, I wrote a simple control script. The functions are the tools and the controller script \"orchestrates\" their use. The controller script becomes a re-usable tool itself.<\/p>\n\n\n\n<pre title=\"CleanTemp.ps1\" class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\"><em>#requires\u00a0-version\u00a05.1<\/em>\n\n<em>&lt;#<\/em>\n<em>\u00a0\u00a0CleanTemp.ps1<\/em>\n<em>\u00a0\u00a0A\u00a0control\u00a0script\u00a0to\u00a0clean\u00a0temp\u00a0folders\u00a0of\u00a0files\u00a0since\u00a0last\u00a0boot<\/em>\n<em>\u00a0\u00a0and\u00a0empty\u00a0folders.<\/em>\n<em>#><\/em>\n[cmdletbinding(SupportsShouldProcess)]\nParam(\n\u00a0\u00a0[Parameter(Position\u00a0=\u00a00,HelpMessage\u00a0=\u00a0\"Specify\u00a0the\u00a0temp\u00a0folder\u00a0path\")]\n\u00a0\u00a0[string[]]$Path\u00a0=\u00a0@($env:temp,\u00a0'c:\\windows\\temp',\u00a0'D:\\Temp')\n)\n\n<em>#dot\u00a0source\u00a0functions<\/em>\n.\u00a0C:\\scripts\\Remove-EmptyFolder.ps1\n.\u00a0C:\\scripts\\Remove-File.ps1\n\n<em>#get\u00a0last\u00a0boot\u00a0up\u00a0time<\/em>\n$bootTime\u00a0=\u00a0(Get-CimInstance\u00a0-ClassName\u00a0Win32_OperatingSystem).LastBootUpTime\nWrite-Verbose\u00a0\"Last\u00a0boot\u00a0=\u00a0$boottime\"\n<em>#delete\u00a0files\u00a0in\u00a0temp\u00a0folders\u00a0older\u00a0than\u00a0the\u00a0last\u00a0bootup\u00a0time<\/em>\nforeach\u00a0($folder\u00a0in\u00a0$Path)\u00a0{\n\u00a0\u00a0if\u00a0(Test-Path\u00a0$Folder)\u00a0{\n\u00a0\u00a0\u00a0\u00a0Remove-File\u00a0-path\u00a0$folder\u00a0-cutoff\u00a0$bootTime\u00a0-recurse\u00a0-force\n\u00a0\u00a0\u00a0\u00a0Remove-EmptyFolder\u00a0-path\u00a0$folder\n\u00a0\u00a0}\n\u00a0\u00a0else\u00a0{\n\u00a0\u00a0\u00a0\u00a0Write-Warning\u00a0\"Failed\u00a0to\u00a0validate\u00a0$($folder.toUpper())\"\n\u00a0\u00a0}\n}<\/code><\/pre>\n\n\n\n<p>The script parameters have default values that make this very simple for me to run. I could, and probably should, put the cleaning functions in a module since they are related. But until then, I'll simply dot-source the files. The controller script passes the necessary parameters to the underlying commands. Within seconds, my temp folders are cleaned. <\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Schedule the Task<\/h2>\n\n\n\n<p>Now that I think about it, what I should probably do, is create a PowerShell scheduled job to run this script at logon.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code lang=\"powershell\" class=\"language-powershell\">$params\u00a0=\u00a0@{\n\u00a0\u00a0\u00a0\u00a0FilePath\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0=\u00a0\"C:\\scripts\\CleanTemp.ps1\"\n\u00a0\u00a0\u00a0\u00a0Name\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0=\u00a0\"ClearTemp\"\n\u00a0\u00a0\u00a0\u00a0Trigger\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0=\u00a0(New-JobTrigger\u00a0-AtLogOn)\n\u00a0\u00a0\u00a0\u00a0MaxResultCount\u00a0=\u00a01\n}\n\nRegister-ScheduledJob\u00a0@params<\/code><\/pre>\n\n\n\n<p>Now I never need to worry about Spring cleaning!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Springtime is approaching in North America. Where I live, the snow has finally melted and we have blue skies with warmer temperatures. Of course, this means Spring Cleaning. Time to clear out the winter debris and spruce up the house. For me, this is also a good time for some computing housecleaning as well. I&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New on the Blog: Cleaning with #PowerShell Revisited","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,8],"tags":[224,534,445,540],"class_list":["post-8241","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-function","tag-powershell","tag-remove-item","tag-scripting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.6 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Cleaning with PowerShell Revisited &#8226; The Lonely Administrator<\/title>\n<meta name=\"description\" content=\"It is that time of year to clean out the junk and temp files. Here&#039;s how I&#039;m handling the task these days with PowerShell.\" \/>\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\/8241\/cleaning-with-powershell-revisited\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Cleaning with PowerShell Revisited &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"It is that time of year to clean out the junk and temp files. Here&#039;s how I&#039;m handling the task these days with PowerShell.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-23T17:06:15+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-03-23T17:06:20+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/pexels-furkanfdemir-5816569.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=\"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\\\/8241\\\/cleaning-with-powershell-revisited\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8241\\\/cleaning-with-powershell-revisited\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Cleaning with PowerShell Revisited\",\"datePublished\":\"2021-03-23T17:06:15+00:00\",\"dateModified\":\"2021-03-23T17:06:20+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8241\\\/cleaning-with-powershell-revisited\\\/\"},\"wordCount\":572,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8241\\\/cleaning-with-powershell-revisited\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/pexels-furkanfdemir-5816569.jpg\",\"keywords\":[\"Function\",\"PowerShell\",\"Remove-Item\",\"Scripting\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8241\\\/cleaning-with-powershell-revisited\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8241\\\/cleaning-with-powershell-revisited\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8241\\\/cleaning-with-powershell-revisited\\\/\",\"name\":\"Cleaning with PowerShell Revisited &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8241\\\/cleaning-with-powershell-revisited\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8241\\\/cleaning-with-powershell-revisited\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/pexels-furkanfdemir-5816569.jpg\",\"datePublished\":\"2021-03-23T17:06:15+00:00\",\"dateModified\":\"2021-03-23T17:06:20+00:00\",\"description\":\"It is that time of year to clean out the junk and temp files. Here's how I'm handling the task these days with PowerShell.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8241\\\/cleaning-with-powershell-revisited\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8241\\\/cleaning-with-powershell-revisited\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8241\\\/cleaning-with-powershell-revisited\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/pexels-furkanfdemir-5816569.jpg\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/03\\\/pexels-furkanfdemir-5816569.jpg\",\"width\":160,\"height\":213},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/8241\\\/cleaning-with-powershell-revisited\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Cleaning with PowerShell Revisited\"}]},{\"@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":"Cleaning with PowerShell Revisited &#8226; The Lonely Administrator","description":"It is that time of year to clean out the junk and temp files. Here's how I'm handling the task these days with PowerShell.","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\/8241\/cleaning-with-powershell-revisited\/","og_locale":"en_US","og_type":"article","og_title":"Cleaning with PowerShell Revisited &#8226; The Lonely Administrator","og_description":"It is that time of year to clean out the junk and temp files. Here's how I'm handling the task these days with PowerShell.","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/","og_site_name":"The Lonely Administrator","article_published_time":"2021-03-23T17:06:15+00:00","article_modified_time":"2021-03-23T17:06:20+00:00","og_image":[{"url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/pexels-furkanfdemir-5816569.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":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Cleaning with PowerShell Revisited","datePublished":"2021-03-23T17:06:15+00:00","dateModified":"2021-03-23T17:06:20+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/"},"wordCount":572,"commentCount":1,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/pexels-furkanfdemir-5816569.jpg","keywords":["Function","PowerShell","Remove-Item","Scripting"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/","name":"Cleaning with PowerShell Revisited &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/#primaryimage"},"thumbnailUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/pexels-furkanfdemir-5816569.jpg","datePublished":"2021-03-23T17:06:15+00:00","dateModified":"2021-03-23T17:06:20+00:00","description":"It is that time of year to clean out the junk and temp files. Here's how I'm handling the task these days with PowerShell.","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/pexels-furkanfdemir-5816569.jpg","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2021\/03\/pexels-furkanfdemir-5816569.jpg","width":160,"height":213},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/8241\/cleaning-with-powershell-revisited\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Cleaning with PowerShell Revisited"}]},{"@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":6142,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6142\/join-me-for-a-2-day-powershell-scripting-workshop\/","url_meta":{"origin":8241,"position":0},"title":"Join Me for a 2 Day PowerShell Scripting Workshop","author":"Jeffery Hicks","date":"November 12, 2018","format":false,"excerpt":"I am very happy to announce a 2 day public PowerShell learning event. In association with the fine people behind the Techmentor conference, I will be presenting a 2 day PowerShell Scripting workshop in Dallas, TX on February 4-5, 2019. There is an option to attend virtually, but you'll really\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"announcer-blue","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2018\/11\/announcer-blue_thumb.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":3117,"url":"https:\/\/jdhitsolutions.com\/blog\/scripting\/3117\/msdevwny-powershell-advanced-functions\/","url_meta":{"origin":8241,"position":1},"title":"MSDevWNY PowerShell Advanced Functions","author":"Jeffery Hicks","date":"June 20, 2013","format":false,"excerpt":"Last night I presented for the MSDevWNY user group in the Buffalo, NY area. They were an interested and enthusiastic audience and I think we could have spent another few hours talking about PowerShell. My presentation was one I've given before on Advanced PowerShell functions. I promised the group a\u2026","rel":"","context":"In &quot;Best Practices&quot;","block_context":{"text":"Best Practices","link":"https:\/\/jdhitsolutions.com\/blog\/category\/best-practices\/"},"img":{"alt_text":"talkbubble-v3","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2012\/05\/talkbubble-v3-150x150.png?resize=350%2C200","width":350,"height":200},"classes":[]},{"id":92,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/92\/powershell-dba\/","url_meta":{"origin":8241,"position":2},"title":"PowerShell DBA","author":"Jeffery Hicks","date":"January 26, 2007","format":false,"excerpt":"There is a very nice review of the new Powershell book at : http:\/\/weblog.infoworld.com\/dbunderground\/archives\/2007\/01\/rtfm.html. I'm glad he likes the book, even though he doesn't know who I am. But I'm working on it!! Anyway, the interesting point in his review is that he is looking at PowerShell from the perspective\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":558,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/558\/promoting-scripting-and-powershell\/","url_meta":{"origin":8241,"position":3},"title":"Promoting Scripting and PowerShell","author":"Jeffery Hicks","date":"January 21, 2010","format":false,"excerpt":"Last week I was interviewed on the Mind of Root podcast about what administrators can do to promote PowerShell and automation in their environments. The show is now available for streaming or download. I still think your best approach is to gently let everyone know that it's not a matter\u2026","rel":"","context":"In &quot;Exchange&quot;","block_context":{"text":"Exchange","link":"https:\/\/jdhitsolutions.com\/blog\/category\/exchange\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7468,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7468\/powershell-7-scripting-with-the-powershell-ise\/","url_meta":{"origin":8241,"position":4},"title":"PowerShell 7 Scripting with the PowerShell ISE","author":"Jeffery Hicks","date":"May 11, 2020","format":false,"excerpt":"By now, everyone should have gotten the memo that with the move to PowerShell 7, the PowerShell ISE should be considered deprecated. When it comes to PowerShell script and module development for PowerShell 7, the recommended tool is Visual Studio Code. It is free and offers so much more than\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ise-ps7.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ise-ps7.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ise-ps7.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/05\/ise-ps7.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":748,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/748\/get-your-free-scripting-toolkit\/","url_meta":{"origin":8241,"position":5},"title":"Get Your Free Scripting Toolkit","author":"Jeffery Hicks","date":"July 29, 2010","format":false,"excerpt":"If you were at this year's TechEd event in New Orleans, I hoped you dropped by the SAPIEN Technologies booth and picked up your free Scripting Toolkit. What's that you say? Check it out on the SAPIEN blog and then download your free copy.","rel":"","context":"In &quot;Books&quot;","block_context":{"text":"Books","link":"https:\/\/jdhitsolutions.com\/blog\/category\/books\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8241","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=8241"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/8241\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=8241"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=8241"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=8241"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}