Updating Pester module to 4.0.2

I was going to do some Operational Testing development in an environment and did see that the new Pester 4.0.2 RC had been released on the PowerShell Gallery!

Woop Niiice, but ey I had already on my newly provisioned Windows Server 2016 the version 3.4.0 of the module and when trying to install from the gallery it complains about the catalog signing..

I wanted to uninstall the 3.4.0 but that one had not been installed with the PowerShell Get so I could not use the Uninstall-Module -Name Pester

So I used the Remove-Item instead, looking at the module base path I could use that one for removal of the folder and files of the 3.4.0 module and then install the 4.0.2

Now back to creating some lovely test files but this time with the 4.0.2 RC version 🙂

Windows Updates eats up the system drive and how to mitigate this

I had a instance that I provisioned within the cloud and after running for a while it has been slowly eating up space on the system drive and if the system drive is not large enough once provisioned there is no easy way to just expand it online…

So how can I remove stuff from the Windows\WinSxS folder in a safe manner, and yes removing them by just deleting is not the way to go because that will get you into trouble big time!

So how do you do it then?

Jan has written a blog post about using DISM and you can then massage so the files that have been superseded by a new patch or service pack can be removed thus saving space

To analyse if it is needed you can run the

DISM /online /Cleanup-Image /AnalyzeComponentStore

And then you can as described in Jan´s blog post either run

DISM /online /Cleanup-Image /StartComponentCleanup

or

DISM /online /Cleanup-Image /StartComponentCleanup /ResetBase

Where the later cleans out so you cannot uninstall updates or servicepacks (although there is more cumulative updates rather than servicepacks nowadays )

But what do you do when it fails?

There is a switch for the command that helps out here

DISM /Online /Cleanup-Image /RestoreHealth

after running this and I had actually to repair twice before I could get a successful cleanup 🙂

And yes I know the best way is to respawn instances instead of patching them and in a perfect world that would be the best of course…