Tag: Windows server

Activating Windows Server 2012 with MAK key

It appears the default activation in Windows Server 2012 is KMS.

win_isnt-activated

Since I’m a primarily a 2008 R2 shop and this is my first ‘real’ 2012 server, I was waiting for the prompt to activate it with my MAK key, but when I clicked Activate, it gave me an error about KMS.

The quick way to activate your server with MAK is to Open a command prompt and run as administrator.

Run As Administrator

At the prompt, enter: slmgr.vbs /ipk xxxxx-xxxxx-xxxxx-xxxxx

replace the Xs with your MAK Key and hit enter.

Enter Key

Your copy of Windows Server is now activated.

activated

Reboot your Windows server at a specified time

We’ve all run up against a scenario where a newly installed application will not work properly unless you reboot the server. The problem with that is you are probably working on the app during business hours and a reboot is out of the question right now. There are 2 easy ways to schedule a reboot of your Windows server to happen during off hours with no late night RDP sessions required.

*disclaimer*

Please test these procedures on a test box before using them on your production server. Also, there are several ways to do this, just Google them and you’ll see what I mean. This was performed on Windows 2008 R2 SP1.

Option #1 Using Task Scheduler and a batch file

To prepare your server for a late night/early morning reboot, do the following:

Open notepad and enter the following:
@echo off
echo rebooting the server
ping yahoo.com
shutdown /r /f /d p:4:1 /c "Planned restart by Techmom"

I inserted the ping to slow down the command just a bit so I can test it abort the shutdown with a shutdown /a at a command line.
/r = restart
/f= force running apps closed without warning users
/d = Provide reason for restart
p:4:1= Planned:Major:Minor = Application: Maintenance (Planned)
/c = Comment on the reason of the restart or shutdown

Event Properties

This is what you’ll see in the event log regarding the reboot. The comment is a good place to make a note of why the reboot must occur.

Once you know it works, time to create a task.

Open Task Scheduler. In the Actions Panel, click create task. Click each tab and choose the options that will allow you to perform your reboot. My settings are as follows:

createtask-general

General Tab

reboot-sched

Trigger Tab, click New.

action-tab

Action Tab, click new and browse to the batch script.

Conditions & Settings Tabs are with the default options selected.

Test the schedule to confirm the system will reboot.

If you are logged in during the test, you will see the warning popup informing you of the impending reboot.

popup-plannedrestartr

Your server will reboot on the schedule you set. Review the event logs and the task scheduler library to confirm the reboot was successful.

reboot-successful

Option #2 Use PSShutdown

PSShutdown is a Systernals utility that you can download from Microsoft to reboot local and remote machines. Follow the installation instructions before use.

This tool allows you to issue a psshutdown command from the command line, specify the reboot time as well as add parameters. To get a full list of the switches issue a PsShutdown /? at the prompt.

Open the command prompt and enter the command.  In this example, I’ve chosen  the following:

psshutdown2

-r = reboot

-f = Force apps close

-t = Time to start shutdown

-m = Message

Upon reboot, review the event log for more information on your reboot.

psshutdown-event

Social media & sharing icons powered by UltimatelySocial