Recover SQL Server from ‘Suspect’ Status

Last night, I had a power outage and a SQL Server went down. When I rebooted it, the database was in ‘Suspect’ mode. After some quick googling I found a solution.

[code lang=”sql”]
EXEC sp_resetstatus ‘yourDBname’;
DBCC checkdb(‘yourDBname’);

Posted in sql | Comments Off on Recover SQL Server from ‘Suspect’ Status

Date Diff in PHP

Thanks to Ryan Means, I have an easy way to find the difference between 2 dates/times in PHP.

[code lang=”php”]
$totalsec=XXXXXXX; //Replace the X’s with a int value of seconds
$daysarray = explode(".", ($totalsec/SecInDay));
$days = $daysarray[0];
$partdays = fmod($totalsec, SecInDay);
$hoursarray = explode(".", ($partdays/SecInHour));
$hours = $hoursarray[0];
$parthours = fmod($partdays, SecInHour);
$minarray = explode(".", ($parthours/SecInMin));
$min = $minarray[0];
$sec = fmod($parthours, SecInMin);
echo "days " . $days . " ";
echo "hours " . $hours . " ";
echo "minutes " . $min . " ";
echo "seconds " . $sec . " ";

Posted in php | Comments Off on Date Diff in PHP

MSDTC event 53258

I work with windows virtual machines a LOT.

One thing that I have noticed is that if a windows VM that has been copied, NewSided (had NewSid run on it), and has been added to a domain, it can generate a “MSDTC Event 53258” frequently.

EventID: 53258
MS DTC could not correctly process a DC Promotion/Demotion event. MS DTC
will continue to function and will use the existing security settings. Error
Specifics: d:srvrtmcomcomplusdtcdtcadmeuiname.cpp:9280, Pid: 1148
No Callstack,
CmdLine: C:WINDOWSsystem32msdtc.exe

EventID: 53258
MS DTC could not correctly process a DC Promotion/Demotion event. MS DTC
will continue to function and will use the existing security settings. Error
Specifics: %1

After a bunch of time googling, I found a solution that will make this problem go away:

1. Run the Component Services MMC snap-in: Start -> Administrative Tools ->
Component Services.
2. Open Console Root -> Component Services -> Computers.
3. Right-Click on My Computer (in the Component Services window) and click Properties.
4. Open the MSDTC tab and click OK.
5. Close the Component Services window.
6. From a Command Prompt type net stop msdtc && net start msdtc.

Now you won’t get the MSDTC errors in the event log.

I believe that this process resets the computer name that MSDTC tries to connect to. In my case it was trying to connect to the computer named “base-vm”, but that computer no longer exists.

Posted in windows | Comments Off on MSDTC event 53258

Telnet to test SMTP

Since I wrote up testing pop3 with telnet, I thought I would also write about how you can test SMTP with telnet.

From a command line in windows:


open IPofSmtpServer 25

220 mail.server.domain Microsoft ESMTP MAIL Service, Version: 6.0.3790.3959 ready at . . . .


( is the FROM domain)

250 OK


250 2.1.0 . . .Sender OK


250 OK –


354 Start mail input; end with <CRLF>.<CRLF>

Subject: The Subject of the message.

Press enter TWICE.

The body of the message goes here.

Press enter.

Enter a single period (.) and press enter once more.

250 2.6.0 <………………….> Queued mail for delivery


221 2.0.0 Service closing transmission channel


Lots more SMTP info.

Posted in troubleshooting | Comments Off on Telnet to test SMTP

Telnet to test pop3

I found an easy way to test a pop3 connection today. It is a little known tool called telnet (It’s not really little known, but I never thought of using it for pop3, so in my mind it is little known for that purpose 😉 ).

From a command line in windows:

telnet NameOfPop3Server 110

user username

pass password


You will see a list of email in your mailbox

retr msgNumber

You will see the email you requested



More POP3 commands:

stat – Returns the number of messages in mailbox and size of mailbox

dele msgNumber – Marks message msgNumber for deletion.

noop – Doesn’t do anything, just returns a positive response.

rset – Unmarks any messages that are marked for deletion.

top msgNumber numLines – Returns the header info and numLines of the body of message msgNumber.

uidl msgNumber – Returns the message number and the messages Unique ID Listing.


Note: If the telnet session ends for any reason other than using the quit command, messages marked for deletion will not be deleted.

Posted in troubleshooting | Comments Off on Telnet to test pop3

Unblock “unsafe” attachments in Outlook

So I went to open the .exe file that I sent myself yesterday and I found out that Outlook 2007 will not let you download “unsafe” attachments (unsafe meaning “Any file with an executable extension”). This bothered me, so I googled how to disable the feature.

Sadly you cannot completely disable it, you can only add file types that you want to download anyway.

Open the registry editor (Click Start->Run and type regedit)

• Browse to:

Outlook 2007


Outlook 2003


Outlook 2002


Outlook 2000



• Add a new String value named: Level1Remove

• Edit the value and add the extension(s) that you would like to allow (use a ‘;’ as a delimeter)

Ex: .exe or .bat;.exe;.mst


• Restart Outlook (You don’t need to restart the computer)

Posted in outlook, windows | Comments Off on Unblock “unsafe” attachments in Outlook

Date and Time in .bat

I will skip right to the good stuff.

Here are some easy Date/Time variables for a batch file.

[code lang=”powershell”]
@echo off
set d=%date:~7,2%
set DD=%date:~0,3%
set m=%date:~4,2%
set YY=%date:~10,4%
set y=%date:~12,2%
set H=%time:~0,2%
set i=%time:~3,2%
set s=%time:~6,2%
set ms=%time:~9,2%
echo d: %d%
echo DD: %DD%
echo m: %m%
echo YY: %YY%
echo y: %y%
echo H: %H%
echo i: %i%
echo s: %s%
echo ms: %ms%

Will Output

[code lang=”text”]
d: 24
DD: Wed
m: 02
YY: 2010
y: 10
H: 14
i: 36
s: 32
ms: 18

Hope it helps.

Posted in bat | Comments Off on Date and Time in .bat

Changing Hostname and IP in Red Hat linux

So I am new to administrating Linux servers so I am going to post about all the simple things that a noob Linux admin would want to know.

I built a base Linux vm in Microsoft Virtual Server 2005. If I copy the vhd file from that base install, what do I need to change before I add it to the production environment?

** Note: I am using a Red Hat Linux OS (CentOS v5.3).

Change the Hostname

First we need to change the computer’s Hostname.

To change the computer’s Hostname, edit these files:


[code lang=”html”] localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6


[code lang=”html”]

For the Hostname change to take effect, you need to reboot the computer.

Change the IP Address

To change the IP address of a CentOS 5.3 server, edit:


[code lang=”html”] localhost.localdomain localhost
::1 localhost6.localdomain6 localhost6


[code lang=”html”]

Add DNS Servers

Finally we need to add some DNS servers since we won’t get them from DHCP any more.

To add the DNS Servers, edit:


[code lang=”html”]

To make the changes take effect, you need to either reboot, or restart the network service.

To restart the network service:

[code lang=”html”]
/etc/init.d/network restart


[code lang=”html”]
service network restart

Well that’s it for today.

Posted in linux | Comments Off on Changing Hostname and IP in Red Hat linux

First Time

So, I decided to hop on the wagon and start a blog. I have been a part of the blogging community for years, mostly reading, sometimes commenting, but never posting. Today is the day that I am going to change that.

I am mainly writing this because I am a nerd with a lot of stuff going on in my mind. I am going to use WordPress to get some of my nerdy thoughts out of my mind, and possibly help some of the people of the internet with my nerdy thoughts.

This is my motto for now.


Posted in Uncategorized | Comments Off on First Time