PowerShell
Pester 5 scope issues and calling PSScriptAnalyzer
· β˜• 2 min read · ✍️ Javy de Koning
The latest version of Pester has some breaking changes. Variables are no longer leaking to 'it' blocks. This might break some unit-tests.

VxRail monitoring options
· β˜• 6 min read · ✍️ Javy de Koning
Recently I’ve been tasked with setting up VxRail monitoring for a Dell EMC VxRail Appliance. Even though I’ve succeeded setting this up, it was has not been a smooth sail. Therefore, I’ve written this blog to help you setup monitoring for VxRail. Setup VxRail monitoring (EMC does not want you to) Since VxRail is initially setup by the vendor I had to get acquainted with the product first. The first thing you should probably do after taking a product into management is setup monitoring.

PowerCLI last patch date script to get VIB install date
· β˜• 1 min read · ✍️ Javy de Koning
PowerCLI last patch date You might find yourself wanting a report of when your vSphere servers have been patched for the last time. Here you will find a simple PowerCLI script that uses vSphere CLI to query the last VIB install date. PowerCLI script: 1Get-VMHost | ForEach-Object -Process { 2 [PSCustomObject]@{ 3 'lastpatchdate' = [datetime]((Get-ESXCli -VMHost $_).software.vib.list() | 4 Select-Object -Property installdate -ExpandProperty installdate | 5 Sort-Object -Descending)[0] 6 'host' = $_.

Fixing: NanoServer Package.cat does not match the hash
· β˜• 1 min read · ✍️ Javy de Koning
Today I was deploying Windows Server 2016 Nano. After the deployment I wanted to install the IIS packages but I ran into the following error-message: The module ‘NanoServerPackage’ cannot be installed because the catalog signature in ‘NanoServerPackage.cat’ does not match the hash generated from the module. From PowerShell: 1Find-PackageProvider NanoServerPackage | 2 Install-PackageProvider -force Install-PackageProvider : The module ‘NanoServerPackage’ cannot be installed because the catalog signature in ‘NanoServerPackage.

Shrink Direct Access Database using PowerShell.
· β˜• 3 min read · ✍️ Javy de Koning
We recently ran into an issue where the a system was running out of space on the system-drive. After initial investigation we’ve discovered that Direct Access Database Windows Internal Database was consuming a lot of drive-space on a system-drive. Below I will explain how to shrink Direct Access database In the output above we used RoboCopy to calculate the folder sizes, if you want to know more about that, read my previous blog post here: Faster Dir Size calculations in PowerShell!

PowerCLI one-liner to validate ESXi root passwords.
· β˜• 2 min read · ✍️ Javy de Koning
Below is a PowerCLI one-liner you can use to validate if all your root passwords are what you expect them to be. 1get-vmhost | %{ 2 $null = connect-viserver $_.name ` 3 -user root -password "MyFakePassword" -EA 0 4 5 if (-not ($?)) { 6 write-warning "Password failed for $($_.name)" 7 } else { 8 Disconnect-VIServer $_.name -force -confirm:$false 9 } 10} Reset a known password over PowerCLI Below is a short code snippet to help you change your root password on ESXi hosts.

Getting started with AppVeyor.
· β˜• 6 min read · ✍️ Javy de Koning
AppVeyor is a CI/CD (Continuous Integration / Continuous Deployment) platform that’s aimed at .NET developers. In this blog-post I’ll take you through the basics for setting up your first Project. We will be building, testing and deploying a PowerShell Module to the PowerShell Gallery using AppVeyor and GitHub. Getting started Before we go into the details you will need fork my AppVeyorDemo repository OR setup your own GitHub repository. Next sign-in and add your project.

Faster Dir Size calculations in Powershell!
· β˜• 3 min read · ✍️ Javy de Koning
Get-ChildItem is probably the command that’s most used when working in PowerShell console. Next to file-system operations the command is also excellent to browse objects accessible via PSDrive(s). Most sysadmin’s are probably familiar with tools such as TreeSize and/or WinDirStat. Did you ever wonder why these tools are so much faster than Get-ChildItem? There is even a PowerShell TreeSize implementation available on the PSGallery, however it’s pretty slow when running on large file-servers.

Powershell 5: collection is read-only.
· β˜• 2 min read · ✍️ Javy de Koning
Powershell 5: An error occurred while creating the pipeline Today I was working with a Server 2016 TP5 server over PSR and I ran into this issue with one of my scripts: 1Do-Something 2An error occurred while creating the pipeline. 3 + CategoryInfo : NotSpecified: (:) [], 4 RuntimeException 5 + FullyQualifiedErrorId : RuntimeException This script has been working fine on other systems so far so I was a bit confused.

How to kill a service stuck in pending state.
· β˜• 2 min read · ✍️ Javy de Koning
WinRM β€˜StopPending’ issues Recently I logged into a machine and ran β€˜Enable-PSRemoting -Force’ to end up with error code β€˜2150858770’. WinRM service was in β€˜StopPending’ state: 1Enable-PSRemoting -force 2WinRM has been updated to receive requests. 3WinRM service started. 4 5Set-WSManQuickConfig : <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2150858770" M 6achine="blabla.local"><f:Message>The client cannot connect to the destination specified in the request. Verify 7 that the service on the destination is running and is accepting requests. Consult the logs and documentation for the W 8S-Management service running on the destination, most commonly IIS or WinRM.

Eventlog tailing and parsing the using Powershell!
· β˜• 3 min read · ✍️ Javy de Koning
Issue Last week I ran into a few DFS issues. When troubleshooting I like to actively watch the log file, or in this case, the Windows Eventlog. On Linux I would use tail -f but what about Windows Eventlog? Also, I only needed a certain part of the information, so there is a need to parse the Eventlog as well. Powershell to the rescue! Powershell solution So we need to:

Use PowerShell to spell names, passwords etc!
· β˜• 4 min read · ✍️ Javy de Koning
We frequently need to spell out names, ticket ID’s or other complex “words” over the phone. We also frequently deal with some special characters in passwords and so-on. If you don’t often practice this, quickly spelling-out over the phone might be difficult. To counter this issue I’ve decided to create a simple PowerShell function for people to put into their profile for easy access. It works like this: 1Get-NatoSpelling 'MyP@$sw0rd_!$_c00l' Result:

Write-Progress… The proper way!
· β˜• 2 min read · ✍️ Javy de Koning
Write-Progress Issues So, you wrote a script and included nifty progress bar, fairly simple. But your script runs slow, especially in a Powershell terminal. Let me explain how you can address this issue. First, the relevant part of the script: 1for ($i=0; $i -le 10000; $i++) { 2 Write-Progress -Activity Testing -Status something -PercentComplete (($i/10000)*100) 3} As an example let’s tun it in the ISE, wrapped in Measure-Command to time the performance and…