List all nodes in an S2D cluster and their disks

You can always select other fields, but these seemed the most important to me to see where to find which disk. The output will be a nice list of disks, separated by server:

Read More

Patching servers manually, but remotely

Here’s a short snippet that will allow you to patch machines remotely:

Thanks windowsitpro.com

Read More

Solving a problem with “Get-VM” cmdlet

Environment: Domain “nice.domain” script server “server1.nice.domain” Hyper-V hypervisor “hyperv1.nice.domain” all Windows Server 2012 R2 script user “nice\script” script user is member of “Hyper-V Administrators” group on hyperv1. script user has the “Log on as a batch job” right on server1 Scenario 1: running

in a Powershell console window on server1 (which was started with […]

Read More

Allow an unprivileged domain user to start and stop services on a Windows server

Use case: You have a script server that does recurring scheduled administrative tasks for you. One of these is to regularly restart a remote machine’s service “greatservice1”. create a domain user “yourdomain\script-user-1” use subinacl from the Windows Resource Kit to grant that user the right to start and stop the “greatservice1” service on the remote […]

Read More

Getting the server response when Invoke-Webrequest results in error 5xx

Hi there, lately, I’ve been confronted with a problem where I simply couldn’t get meaningful error messages from failing runs of Invoke-Webrequest. In doing something like this:

$err would only ever contain the error code like “500 bla”, but not what the server actually returned as the error message. I was querying a REST […]

Read More

Use Powershell and 7-zip to zip up files in a directory individually

Today I needed to put the files I had in a directory into zip files, each one in its own archive. After fiddling around with how to quote and double quote stuff in PoSh I found this link on the technet forums. See Section 5 there. This is how it’s done:

$arg1…$arg4 are the […]

Read More

How to delete files older than x

Something I regularly need to do is search for files that are older than a certain amount of time and do something with them, like move or delete. Here’s a handy snippet how to do it in PoSh.

The question mark is an alias for Where-Object, -le means “less than or equal”, and AddMinutes […]

Read More