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"

Rebuild the Exchange 2010 Offline Address Book

Create a new Offline Address Book object

  1. Open the Exchange Management Console (EMC) and navigate to Organisation Configuration – Mailbox
  2. Click the Offline Address Book tab.  Right click in the blank area and click New Offline Address Book
  3. Give your OAB a different name than the existing one
  4. Select your Exchange 2010 MBX server as the OAB generation server
  5. Check Include the default Global Address Lists option
  6. Check Enable Web-based Distribution as well as the Enable public folder distribution option
  7. Finish the wizard

Restart Exchange Services

  1. Restart the Microsoft Exchange System Attendant service
  2. Restart the Microsoft Exchange File Distribution service

Update and set the OAB as default Offline Address Book

  1. Right-click your newly created OAB and click Update.  This can take a couple of minutes, confirm successful completion via your Application log
  2. Right-click the OAB from step 1 and and click Set as default

Assign the OAB to the affected users databases

  1. Open the Exchange Management Shell (EMS)
  2. Execute the following:
    Get-MailboxDatabase |  set-MailboxDatabase  -OfflineAddressBook “%your new OAB%”
  3. Wait for Outlook to complete it’s OAB download cycle (can be as much as 24 hours)

You can safely delete the old OAB once you’ve verified that your clients are successfully downloading the newly created one.

Task Scheduler Error and Success Codes

SCHED_S_TASK_READY
0x00041300
The task is ready to run at its next scheduled time.
SCHED_S_TASK_RUNNING
0x00041301
The task is currently running.
SCHED_S_TASK_DISABLED
0x00041302
The task will not run at the scheduled times because it has been disabled.
SCHED_S_TASK_HAS_NOT_RUN
0x00041303
The task has not yet run.
SCHED_S_TASK_NO_MORE_RUNS
0x00041304
There are no more runs scheduled for this task.
SCHED_S_TASK_NOT_SCHEDULED
0x00041305
One or more of the properties that are needed to run this task on a schedule have not been set.
SCHED_S_TASK_TERMINATED
0x00041306
The last run of the task was terminated by the user.
SCHED_S_TASK_NO_VALID_TRIGGERS
0x00041307
Either the task has no triggers or the existing triggers are disabled or not set.
SCHED_S_EVENT_TRIGGER
0x00041308
Event triggers do not have set run times.
SCHED_E_TRIGGER_NOT_FOUND
0x80041309
A task’s trigger is not found.
SCHED_E_TASK_NOT_READY
0x8004130AContinue reading