Remotely Shutdown a computer attached to a Windows Domain

If you have sufficient rights to manage a remote computer over your company network, you can use this command from CMD.exe to remotely shutdown a computer.


shutdown /s /t 3600 /m \\ /c "Your computer is sleepy."

Issues the shutdown command to Shut down a computer in 3600 seconds, to the remote machine named \\ while displaying the reason to any logged on users as “Your computer is sleepy”.

shutdown /r /t 300 /m \\

Restarts the remote computer in 300 seconds.

shutdown /a /m \\

Immediately aborts the scheduled shutdown or reboot task if it is not yet happening.

Detailed Documentation from Microsoft

C:\Users\Administrator>shutdown /help
Usage: shutdown [/i | /l | /s | /r | /g | /a | /p | /h | /e] [/f]
[/m \\computer][/t xxx][/d [p|u:]xx:yy [/c "comment"]]

No args Display help. This is the same as typing /?.
/? Display help. This is the same as not typing any options.
/i Display the graphical user interface (GUI).
This must be the first option.
/l Log off. This cannot be used with /m or /d options.
/s Shutdown the computer.
/r Shutdown and restart the computer.
/g Shutdown and restart the computer. After the system is
rebooted, restart any registered applications.
/a Abort a system shutdown.
This can only be used during the time-out period.
/p Turn off the local computer with no time-out or warning.
Can be used with /d and /f options.
/h Hibernate the local computer.
Can be used with the /f option.
/e Document the reason for an unexpected shutdown of a computer.
/m \\computer Specify the target computer.
/t xxx Set the time-out period before shutdown to xxx seconds.
The valid range is 0-315360000 (10 years), with a default of 30.
If the timeout period is greater than 0, the /f parameter is
/c "comment" Comment on the reason for the restart or shutdown.
Maximum of 512 characters allowed.
/f Force running applications to close without forewarning users.
The /f parameter is implied when a value greater than 0 is
specified for the /t parameter.
/d [p|u:]xx:yy Provide the reason for the restart or shutdown.
p indicates that the restart or shutdown is planned.
u indicates that the reason is user defined.
If neither p nor u is specified the restart or shutdown is
xx is the major reason number (positive integer less than 256).
yy is the minor reason number (positive integer less than 65536).

Reasons on this computer:
 (E = Expected U = Unexpected P = planned, C = customer defined)
 Type Major Minor Title
U 0 0 Other (Unplanned)
 E 0 0 Other (Unplanned)
 E P 0 0 Other (Planned)
 U 0 5 Other Failure: System Unresponsive
 E 1 1 Hardware: Maintenance (Unplanned)
 E P 1 1 Hardware: Maintenance (Planned)
 E 1 2 Hardware: Installation (Unplanned)
 E P 1 2 Hardware: Installation (Planned)
 E 2 2 Operating System: Recovery (Planned)
 E P 2 2 Operating System: Recovery (Planned)
 P 2 3 Operating System: Upgrade (Planned)
 E 2 4 Operating System: Reconfiguration (Unplanned)
 E P 2 4 Operating System: Reconfiguration (Planned)
 P 2 16 Operating System: Service pack (Planned)
 2 17 Operating System: Hot fix (Unplanned)
 P 2 17 Operating System: Hot fix (Planned)
 2 18 Operating System: Security fix (Unplanned)
 P 2 18 Operating System: Security fix (Planned)
 E 4 1 Application: Maintenance (Unplanned)
 E P 4 1 Application: Maintenance (Planned)
 E P 4 2 Application: Installation (Planned)
 E 4 5 Application: Unresponsive
 E 4 6 Application: Unstable
 U 5 15 System Failure: Stop error
 U 5 19 Security issue
 E 5 19 Security issue
 E P 5 19 Security issue
 E 5 20 Loss of network connectivity (Unplanned)
 U 6 11 Power Failure: Cord Unplugged
 U 6 12 Power Failure: Environment
 P 7 0 Legacy API shutdown
Learn More

Troubleshooting Group Policy Object Application for Users and Computers

Microsoft Group Policy is powerful way to automate configuration of machines and user settings for anything attached to the domain. This article assumes you are familiar with Group Policy and the process of creating, editing, linking, and filtering those group policy objects.

Article Scope: This article is intended for System Administrators to help in diagnosis of Group Policy issues where the settings configured are not working as expected for a user, group, or computer object.

Problem Description: A computer or user is not inheriting the settings you are expecting that they should, from a given GPO.

Symptoms: The GPO has been in place longer than 24-48 hours, and the user should have the most recent group policy, but still isn’t getting the settings you expect.

Diagnosis: There are many steps for diagnosis. I will start with the more basic steps, and then get into the less-likely-but-more-complex aspects of troubleshooting. We will start with checking the state of how the clients are receiving their settings.

Check Client / User is able to receive the updated settings.

  1. Log onto the same computer as the user, and (more…)
Learn More

Compiling PHP with IMAP in DirectAdmin Custom Build

This is a quick guide on how to compile PHP with IMAP and SSL support for DirectAdmin Custom Build.

We will need to install additional libraries, change the build options for PHP5, and then recompile PHP. These instructions are for DirectAdmin 1.2.x and 1.3.x on CentOS 5 (x86-64). Use with caution.

Install needed libraries

yum install libc-client
 yum install libc-client-devel

Reconfigure CustomBuild PHP5 Configuration File

nano /usr/local/directadmin/custombuild/configure/ap2/configure.php5

Add the below lines to the configure.php5 file.

--with-imap=/usr/lib/dovecot/imap \
 --with-imap-ssl \


Recompile PHP5 with our customizations configure.php5

cd /usr/local/directadmin/custombuild/configure/ap2
./build php y

If all goes well, you will see it succeed without error.

Possible Error and Resolution:

Error: /usr/local/directadmin/custombuild/configure/ap2/configure.php5: line 31: –with-imap=/usr/lib/dovecot/imap: No such file or directory
*** There was an error while trying to configure php. Check the configure/ap2/configure.php5 file

To Resolve:

make sure that when you add the line to the configure.php5 that you add a trailing slash \ to the end of the line above it. (The second to last line, but not the last line itself).

for example,


now becomes:

 --enable-mbstring \

Then save and call the build command once more.

Learn More Suggestion – Report Reverse Reply Spam

While allows people viewing ads to report them, there is no mechanism to report spam sent via their built in “contact the seller” messaging service. Potentially anyone who has an account on KSL, can “reply” to a classified listing, and send spam to the original listing creator. It’s a process known as reverse-spamming. In a typical scenario, we might expect the classified listing itself to be the spam. However on legitimate postings, a spammer can capitalize on the concept known as in reverse-spam or reply-spam, where they use as the means of relaying spam to the original classified lister. This is generally a successful technique for spammers because they are able to reach their target with 100% deliverability. Since the Email uses’s email servers for delivery, it will inherit the reputation of their email servers when being processed at the recipients email server. Additionally, the spammer doesn’t actually have to know the target’s email address. They simply have to reply to a listing. An automated bot can crawl the site, and send off many replies with their spammed message in the content, and will facilitate the delivery to their target, the lister.

My wish is that would include an action on each email message sent out to the classifieds lister, where they could report the message as spam. Then they could track abusive users who are doing this reverse-spam methodology and address this problem to bring them in compliance with the CAN-SPAM Act.

Here’s a message I received on my auto listing. It’s obvious that this seller really didn’t want to look at my car.

wes stillman – <redacted>
I’m interested in your vehicle, I would like to look at it and take it for a test drive. Also I run a shutter company in salt lake called Stanfield Shutters we build custom shutters to fit any window no matter the shape or size of them, they come with a warranty. We also match any color or stain as well, would you be interested in trading shutters for the vehicle Thanks Wes

Learn More

Ten Second Mac OS X HTTP Server

Apple Macintosh OS X includes a little known python script which turns your computer into a basic web server. You can use this if you simply want to make an easy way to access files on your mac from another computer. Beware that as this is, there is no security for preventing anyone from connecting into the directory you’re sharing, so use it with caution, and always terminate the process / close it down when you’re done. Whatever directory you publish, will remain accessible with all files and folders within, until you terminate and close the process out. Use with caution.

How to setup an HTTP server on OS X in 10 seconds.

  1. Open Terminal
  2. Change to the directory where you want to serve up content from
    • cd /path/to/what/you/want/to/make/available
  3. Run the HTTP Server process via Python
    • sudo python -m SimpleHTTPServer 80

When you close the Terminal that spawned the python http server; you will end the process and terminate the http server.

Notes: Be mindful of anything you’re sharing as it could potentially be accessible to anyone on the network you are connected to as well as potentially the internet as well; so use with caution.

Learn More

Updating Ubuntu Kernel and Removing All Old Kernels

This is a quick guide on how to update your kernel and supporting header and image files, as well as clean out older ones to free up space on the boot partition. I have used this process and these specific commands on Ubuntu 10.04 through 14.04.

1. SSH in and switch user to get Root Access

sudo su

2. Update all packages

apt-get update;
apt-get upgrade;

3. Install any available kernel, image, and kernel headers packages.

Usually you will see a message stating that apt-get installed 0 items but three are available. You will have to manually type in apt-get install <package name> in order to do these updates. Just copy and paste the item names as you see from the output of apt-get.

4. Reboot

We need to make sure we’re running the most recent kernel and supporting files, especially if we just installed newer versions. We will then be able to remove the older ones.


5. Clean up any no longer needed packages and outdated versions

apt-get autoremove;
apt-get autoclean;

6. Remove remaining unused kernel packages.

This command checks for any existing but no longer used kernels, and deletes them. This prevents your boot partition from filling up with old kernels and supporting files. Use with care!

dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge
Learn More

Remove Exchange Attributes from All Users in Active Directory – Uninstall Exchange Server

If you are attempting to remove Exchange Server from your active directory, you will find that Exchange has created user account attributes that exist on all accounts even after deinstalling Exchange server. If you want to remove these attributes from all accounts, this is a command to do so.

Please take note that you would only ever use this if you have completely deinstalled Exchange from your domain and no longer need it. If you run this command, all accounts will lose their Exchange attributes. This WILL REMOVE Exchange settings for all user accounts. This command is very dangerous. Do not use it unless you know what you are doing. Any use of it is without warranty or liability on my part.


get-aduser -filter {msExchMailboxGuid -like “*”} | set-aduser -clear msExchMailboxGuid,msexchhomeservername,legacyexchangedn,mail,mailnickname,msexchmailboxsecuritydescriptor,msexchpoliciesincluded,msexchrecipientdisplaytype,msexchrecipienttypedetails,msexchumdtmfmap,msexchuseraccountcontrol,msexchversion

The need to remove an Exchange 2013 server using ADSIEdit could have several reasons. The method using ADSIEdit to remove an Exchange server should only be used carefully.

The most common reasons are listed below:

The deinstallation didn’t finish properly and left attributes or entries in Active Directory
The Exchange server is permanent offline and Exchange should be removed
An Exchange installation didn’t finish properly and the attributes and entries should be removed
To remove the server open ADSI-Edit and go to configuration

Navigate to this path:

CN=Microsoft Exchange
CN=Microsoft Exchange Autodiscover

CN=Default naming context,DC=DOMAIN,DC=LOCAL
CN=Microsoft Exchange Security Groups
CN=Microsoft Exchange Security Objects

Additional steps:

Hard Disk:
On the server’s hard disk you’ve to DELETE the Exchange Server installation folder.
Usually it’s C:\Program Files\Microsoft\Exchange Server

DELETE the Exchange Back End and Front End websites with the IIS-Manager

AD Users and Computers:
DELETE the following users in the “Users” container:

DiscoverySearch Mailbox{GUID}
Exchange Online-ApplicationAccount

DELETE the key “ExchangeServer” under:

DELETE the keys “MSExchange*” under:


One final note, I promise: Keep in mind that there will still be Exchange Attributes tied to your existing users in Active Directory and references to the old Exchange Database Store. These will need to be cleaned up, otherwise in the Exchange Console you will get error messages like “Database is mandatory on UserMailbox” (At least on Exchange 2013). You can clean these up with a script that I found here:

Get-ADUser -Properties *

$userlist = Get-ADUser -f * -Properties *
$userlist | ForEach { Set-ADUser $_ -ObjectAttributes @{msexchmailboxguid=”; msexchhomeservername=”; legacyexchangedn=”; mail=”; mailnickname=”; msexchmailboxsecuritydescriptor=”; msexchpoliciesincluded=”; msexchrecipientdisplaytype=”; msexchrecipienttypedetails=”; msexchumdtmfmap=”; msexchuseraccountcontrol=”; msexchversion=” } }

Anyway, I hope this helps someone else out.


#Enable Exchange cmdlets
add-pssnapin *exchange* -erroraction SilentlyContinue

Learn More