Friday, July 11, 2014

To find out which domain controller you are authenticated to on ther server ?

I was helping my friend in finance to check out some issue in test environment, and of course, which starts as "hey, we got some database issue since we can't connect to to backend...". Great pick up line as usual.

So my friend shows me his database issue, and I can point it out straightaway that it is an authentication plus DNS issue rather than database. It rings the bell that my OP team friend told me about a project that they are looking at upgrading the domain controllers and it is reasonable that they are doing a rehearsal for the big date.

There is 2 active directory servers online and I am not sure which one the application server is authenticated from. Well, I found the following handy environment variable for just the job:

Thursday, July 03, 2014

Start / Stop a service at remote Windows server

There is an useful Windows command I learn recently which I thought why I did come across this earlier. It helps a lot when it needs to stop a service on an remote app server prior to run a database script.

The command is sc.

Task Command syntax
To stop a Service sc \\{server} stop {service}
To start a Service sc \\{server} start {service}
To restart a Service sc \\{server} restart {service}

Event ID to identify a system shutdown, startup, reboot and System uptime

How many times that you are surprised by automated Windows patching task which restarts your database server in the middle of a job runs? Of course, you should discuss that with you system admin team to work out how to schedule and deal with Windows patching on database servers. To start a discussion like that, you always need to find if your server does restart in the first place and what time and by who/what.

So, what are you looking for? In the event viewer, you can filter the system logs with the following Event IDs as explain below:

Event ID Description
6005 / 6009 OS started
6006 OS shutdown
6013 OS daily update report. that's the OS has been running for more than a day, measure in seconds.
1074 This sweet event shows you which process and on behalf of which user a reboot was initiated.