Objects in Powershell

$List = New-Object System.Collections.Generic.List[System.Object]

foreach($User in $Users){

    ### Your processing code goes here ###

    $props = @{
        UPN = $User.User
        Type = $Type
    $object = new-object psobject -Property $props

This is my second version of this as I more often want to create custom objects in a loop as the standard properties are missing something or I want to add a value from another query.
I’ve used $Users here as my input array as that’s what I most commonly have to use.

I’ve used a list here instead of an array as they are faster. You can append to a list. To add to an array you actually have to create an array one larger than the last array, populate it with the previous values and the the one you want to add.

Further reading: https://social.technet.microsoft.com/wiki/contents/articles/7804.powershell-creating-custom-objects.aspx

Cleaning out WSUS

This is for when the clean up wizard is borking out and repeatedly running it doesn’t feel like its making any progress (not that it tells you anyway).

The server/instance name to connect to with SSMS is:

If the above doesn’t work then just uninstall WSUS and start again… its not that painful apart from the amount of crap you have to download.