Export Windows Update list

If you want to export a list of updates installed on a Windows 2008 server, there is a built in tool to do this.
Use the WMIs Command-line interface (WMIC) to export this list.

On the command line:

wmic qfe get /format:csv > C:\updates.csv

You can use these other format options:

CSV | HFORM | HTABLE | LIST | MOF | RAWXML

HFORM/HTABLE are HTML
LIST is Tab Delimited
RAWXML is XML

Handy Exchange Management Shell commands

Some Handy Exchange Management Shell commands I frequently use;

  • Enable auditing for all user mailboxes
    Get-Mailbox | Where-Object {$_.RecipientTypeDetails –eq “UserMailbox”} |Set-Mailbox -AuditDelegate Update,SoftDelete,HardDelete,SendAs,Create,FolderBind –Auditenabled $true
  • Get a list of all mailboxes on a Exchange server sorted on size.
    Get-MailboxStatistics -Server SERVERNAME | where {$_.ObjectClass –eq “Mailbox”} | Sort-Object TotalItemSize –Descending | ft @{label=”User”;expression={$_.DisplayName}},@{label=”Total Size (MB)”;expression={$_.TotalItemSize.Value.ToMB()}},@{label=”Items”;expression={$_.ItemCount}},@{label=”Storage Limit”;expression={$_.StorageLimitStatus}} -auto >>C:\Mailboxsize.txt
  • Delete disconnected mailboxes
    $mailboxes = Get-ExchangeServer | Where-Object {$_.IsMailboxServer –eq $true} | ForEach-Object { Get-MailboxStatistics –Server $_.Name | Where-Object {$_.DisconnectDate –notlike ‘’}} | select displayname, mailboxguid, database

    $mailboxes | ForEach { Remove-Mailbox -Database $_.Database -StoreMailboxIdentity $_.MailboxGuid -confirm:$false }
  • Import PST file into a mailbox into a root folder “Archive”
    New-MailboxImportRequest -FilePath \\uncshare\archive.pst -Mailbox MAILBOXNAME -TargetRootFolder "Archive"

Enable Disk Cleanup Utility in Windows 2008 R2

To cleanup your disks from old files, service packs and tempory internet files Windows 7 has a tool called Disk Cleanup.

By default, this tool is not installed on Windows 2008 R2.
There are two ways to enable this:

  1. Install the “Desktop Experience” feature.
    This will install several Windows 7 features on your Windows 2008 R2 server such as Windows Media Player, Photo Management and the Disk Cleanup Utility.
    This is of course something you do not want installed on your server. Also, the server requires a reboot after installing the feature.
     
  2. Copy the files from the WINSXS directory.
    An easier way of enabling this the cleanup utility is to copy the files from the winsxs directory.
    You need two files: cleanmgr.exe and cleanmgr.exe.muiCopy cleanmgr.exe from  C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe to %systemroot%\System32
    Copy cleanmgr.exe.mui from C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_en-us_b9cb6194b257cc63\cleanmgr.exe.mui to %systemroot%\System32\en-US

There you go!

Free Microsoft Office 2013 training

Download free Microsoft Office 2013 training courses.

All the courses are Microsoft PowerPoint 2013 presentations.
Download a free PowerPoint viewer here.

Microsoft Office 2013 training courses

List all Windows updates in HTML or TXT format

wmic qfe list brief /format:htable > "c:\hotfix.html"

This produces a HTML file named “hotfix.html” that gets placed in the root of your C: drive.
If you would rather have a text file, the command would be:

wmic qfe list brief /format:texttablewsys > "%USERPROFILE%\hotfix.txt"