The function is an inline table-valued function (or sometimes called a parameterised view) so it can be used just like a view or a table but needs parameters. It generates a single-column table of datetime2 with rows differing by any multiple of any of the dateparts that SQL Server provides.
This is a simple powershell script to query and display hardware and OS information from a remote computer.
It uses CIM (Common Information Model) that is available since Powershell version 3 so as long as you have version 3 and up, you should be able to run this script against any server that you have access to.
Many people have published high performance, read-less, Inline Table Valued functions that use Itzik Ben-Gan's wonderful "Virtual Numbers Table" to replace WHILE loops and other forms of RBAR. This one is Jeff Moden's version.
Previous Monday to the Start of the Previous Quarter
I realize that this is a bit of a lengthy script for something that you can use a one liner in the power shell:
But I needed to highlight certain properties of given user and take certain actions based on the values. And the result is this power shell script.