Scheduled Reboot Command

To schedule a reboot, create a batch script with the following command:

:: Reboots the computer in 5 mins
shutdown -r -t 300 -c "A scheduled reboot will occur in 5 mins. Open command prompt and type 'shutdown /a' to abort." -f -d P:0:0

This will alert any logged on users that the computer will reboot in 5 mins, and can be aborted by running shutdown /a.

Lastly, create a scheduled task to run the batch script at the required time.

Events

Event ID 1074 will occur in the System log when the command is run:
shutdown-event

Event IDs 6009, 6005 and 6013 will also appear in the System log, with a Source of EventLog.

The precise stop and start time can be found in Event IDs 13 and 12, in the System log, with a Source of Kernel-General.

Related Events

If a Windows Update requires a reboot, you may get Event ID 22 with a Source of WindowsUpdateClienthttp://technet.microsoft.com/en-us/library/cc735614(v=ws.10).aspx

Enable Disk Cleanup on Server 2008 R2 Without Using Add Features

Scenario

You’re running out of space on a computer running Server 2008 R2, but cannot find the Disk Cleanup tool. You know you can add it using Add Features > Desktop Experience, but you just want Disk Cleanup; not the other stuff.

Solution

You need to copy a few files from C:\Windows\winsxs.
Here is a batch script to copy the files to the correct locations, and also pin Disk Cleanup to the Start Menu (using VBScript called PinItem.vbs, shown below): [Read more…]

Notepad++ Text Editor Tips

I recently read some great tips for my favourite text editor, Notepad++:

http://techbrij.com/518/10-notepad-tips-tricks-fast-development

There really isn’t much Notepad++ can’t do, and just when you think you’ve found one, there’s probably a plugin for it.

One example of this is JumpLists. I use them as much as possible, as I find it helps me work faster. With this in mind, I was always disappointed that Notepad++ didn’t have this feature built-in, so it was a pleasant surprise to find a plugin for this last week.

To install the plugin, open Notepad++ and navigate to Plugins > Plugin Manager > Show Plugin Manager.
You then simply select NppJumpList and click Install:

After installing the plugin, you will be able to use JumpLists with Notepad++:

Check IIS Application Pool Identity using C#

To check the IIS Application Pool Identity using C#, use the System.Security.Principal class:

using System.Security.Principal;

then add the following code to the Page_Load method:

WindowsIdentity id = WindowsIdentity.GetCurrent();
Response.Write("<strong>IIS Application Pool Identity</strong><br />");
Response.Write("Name: " + id.Name + "
");

Hardcore troubleshooting using Logs, Process Monitor, PowerShell and Excel

I’m a huge fan of the Sysinternals Suite – Process Monitor being one of my faves – and am loving using PowerShell to do ever more, but this post is at another level: http://blogs.technet.com/b/askds/archive/2012/06/01/what-s-causing-that-dfsr-change-storm.aspx

Hopefully I’ll be able to use similar techniques for those really tricky problems that rear their ugly head from time to time. Bring it on!

How to setup a Javascript Auto-Proxy script for Internet Explorer

Scenario

You have a Main Office and several Branch Offices in your company. You use proxy servers (like Squid) in every office to save bandwidth and increase browsing performance.

However, your mobile users often call in reporting they cannot access the internet when outside the office.

You once again remind them how to untick the “Use a proxy server for your LAN” setting in Internet Explorer; all the while dreaming of a better solution.

Here’s one such solution:

[Read more…]

Copy Veeam backups to USB drive

As we are still rolling out VMware and Veeam B&R throughout our offices, we are not yet in a position to set up replication.

Until we are ready, I thought it was a good idea to at least backup the Veeam backup repository to USB3 drives, which would be rotated and taken offsite daily.

Initially I setup a ‘Veeam File Copy’ job, but later noticed it was taking ages to copy the new incremental files. It seems ‘Veeam File Copy’ jobs do not just copy the new files, but all files every time; not what I wanted.

[Read more…]

Useful Windows commands and variables

I’ve got loads of commands and variables that I use periodically, but I forget them often.

I only have a few that spring to mind now, but I’ll add to this when I remember more!

[Read more…]

The best way to copy files using built-in commands – Robocopy

I’ve tried countless ways of copying and syncing files in the past, the last being the venerable SyncBack backup program.

Although it served its purpose, these days I’m not a fan of installing more applications than absolutely needed, so I thought I’d explore built-in options again.

I’ve used xcopy previously, but I wanted to try something new. Enter Robocopy…and no, it has nothing to do with this guy:

Robocopy was not created by Robocop!

[Read more…]

Disable POP and IMAP for all users in Exchange 2007 2010

Although the POP and IMAP services are disabled by default in Exchange 2007, every mailbox will have the features enabled. This means everyone will be able to use POP and IMAP if you enable the services. What if you only want a few users to use them?

Use this PowerShell cmdlet to disable POP and IMAP for all users in Exchange 2007/2010:

Get-CASMailbox | Set-CASMailbox -PopEnabled $false -ImapEnabled $false

You can then enable the POP and IMAP features for specific users via the GUI or by using this cmdlet:

Set-CASMailbox -Identity adam.rush -PopEnabled $true -ImapEnabled $true