Category: server administration

Send a message to users RDP’d to server

There are 2 users currently logged on a server via remote desktop protocol (RDP) and want to asked them to log out while I perform maintenance. There is a utility in Windows called MSG . It is a utility to send a message to a user that’s currently logged onto a system.

To send a message to a remote server, from the terminal:

$>  msg * /server:SERVER1 /time:30 /v "Could either USER1 or USER4 logout until 1PM? I need access to prepare for the migration next week"
  • * : I’m sending the message to all sessions
  • /server: The name of the server I’m sending the message to.
  • /time:30 : I’m giving the users 30 seconds to acknowledge the message. If no time is listed, the message will stay on the screen until the users click OK.
  • /v : verbose
  • The message to the users should be in quotes
The message as it appears to the users logged into the server

This works in both PowerShell and command prompt.

Error Applying Security- Access is Denied

Windows server administration is not without those DOH! moments. How is it that I, the administrator cannot change the permissions on a folder?

Access Denied Message
I will not be denied

The easiest way to fix this is to take ownership of the folder using the TAKEOWN command. Takeown is a tool that will allow an administrator to recover access to a file or folder that was denied by reassigning ownership. Open the command prompt and run as administrator.

takeown /f F:\FolderName /r /d y

/f  Specify the file name or directory

/r Recurse through all directories and sub directories

/d  Prompt with an answer of Yes

Now you can change the permissions as needed.

Windows Security Prompt
That’s more like it

When .NET wants to be 4.5.2

Someone in the application group said that they wanted .NET downgraded from 4.5.2 to 4.51. I did as I was asked and then in the next few days, I got another call telling me that 4.5.2 was back.  The application they are running is not supported in 4.5.2.

This system isn’t managed by WSUS so Windows update did what it was designed to do.

Here is a link to block the update of .NET to 4.5.2:

How to temporarily block the installation of the .NET Framework 4.5.2

Be sure to backup the registry before you begin.

Browse to:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\NET Framework Setup\NDP\

Add a new Key called WU, then add a new DWORD value named BlockNetFramework452
Modify it and set it to 1.
Exit the registry.

 

 

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