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 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: Get-VMHost | ForEach-Object -Process { [PSCustomObject]@{ 'lastpatchdate' = [datetime]((Get-ESXCli -VMHost $_).software.vib.list() | Select-Object -Property installdate -ExpandProperty installdate | Sort-Object -Descending)[0] 'host' = $_.Name 'version' = $_.version 'build' = $_.
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:
Find-PackageProvider NanoServerPackage | Install-PackageProvider -force Install-PackageProvider : The module ‘NanoServerPackage’ cannot be installed because the catalog signature in ‘NanoServerPackage.cat’ does not match the hash generated from the module.
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!
Below is a PowerCLI one-liner you can use to validate if all your root passwords are what you expect them to be.
get-vmhost | %{ $null = connect-viserver $_.name ` -user root -password "MyFakePassword" -EA 0 if (-not ($?)) { write-warning "Password failed for $($_.name)" } else { Disconnect-VIServer $_.name -force -confirm:$false } } Reset a known password over PowerCLI Below is a short code snippet to help you change your root password on ESXi hosts.
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: 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:
Do-Something An error occurred while creating the pipeline. + CategoryInfo : NotSpecified: (:) [], RuntimeException + FullyQualifiedErrorId : RuntimeException This script has been working fine on other systems so far so I was a bit confused. Google didn’t bring me much results so I decided to run the script locally on my Windows 10 machine and ended up with this:
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:
Enable-PSRemoting -force WinRM has been updated to receive requests. WinRM service started. Set-WSManQuickConfig : <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2150858770" M achine="blabla.local"><f:Message>The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the W S-Management service running on the destination, most commonly IIS or WinRM.
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:
for ($i=0; $i -le 10000; $i++) { Write-Progress -Activity Testing -Status something -PercentComplete (($i/10000)*100) } As an example let’s tun it in the ISE, wrapped in Measure-Command to time the performance and…