Thursday, August 24, 2006

Restarting Microsoft SQL Server 2000 via Scripts

I have noticed that SQL server sucks up most of our Servers RAM by the end of a business day. I have since implemented a simple batch file to run twice a day, once at 06:00 and the second time at 18:00 before our nightly backup.

The basis of this script is the NET command. The Net command has a plethora of sub commands such as Stop, Start, user, use, view, accounts, and so on. An overview of each command can be found here. But we will be using only two of these commands, NET STOP and NET START.

Since the SQL Server Agent (SQLSERVERAGENT) is dependent on SQL Server (MSSQLSERVER) we need to stop it before we do anything with SQL Server. The command to stop a service is NET STOP and in this case we want the Service Name and not the display name. To find the Service name you can right click on the Service and go to properties. On the General Tab the first field is the Service name. We want SQLSERVERAGENT so our command will be NET STOP SQLSERVERAGENT. After the server agent is stopped we can stop the server itself with NET STOP MSSQLSERVER. Then we need to do the reverse of this and run NET START MSSQLSERVER followed by NET START SQLSERVERAGENT.

Our batch file is going to look like this then:

NET STOP SQLSERVERAGENT

NET STOP MSSQLSERVER

NET START MSSQLSERVER

NET START SQLSERVERAGENT

Another command we could use from a remote workstation such as our Administrator’s workstation is the SC command. We will still need to know the service name to use the SC command but there is only one difference. That difference is now we need to specify the server/workstation that we want to control the services of. The server name will be in the form of \\SERVERNAME.

This time our script would look like

SC \\SERVERNAME STOP SQLSERVERAGENT

SC \\SERVERNAME STOP MSSQLSERVER

SC \\SERVERNAME START MSSQLSERVER

SC \\SERVERNAME START SQLSERVERAGENT

Again the SC command has a lot more it can do but that is all the time we have to cover it now. If you want to learn more about the SC command you can visit this web site.

Tuesday, August 22, 2006

Implementing OpenDNS to enhance Enterprise DNS Resolution

We use OpenDNS as our forwarders here for a few reasons. One they are much faster at what they do than our ISP. Two they don’t drop requests for resolution like our ISP does. Three it is much faster than using Root Hints to resolve and cache manually. Four by combining resolution requests from around the country (globe soon) we can all get better resolution.

Setting this up for an Active Directory enterprise is easy. For each of your DNS servers of which you should have at least two, open up the DNS Management Console, right click on the server and choose Properties. Go to the Forwarders tab and check the box for “Enable Forwarders”. Now add in two IP address for the OpenDNS servers. The IP addresses that you want are 208.67.222.222 and 208.67.220.220. Now whenever your server has a resolution request that it cannot fulfill it will look to the OpenDNS servers instead of using root hints to resolve the query.

Monday, August 14, 2006

Manually trigger Active Directory© Replication

Scenario: A new workstation is being placed at the user’s desk. The new user does not have an account in Active Directory and they are in a different site.
How to: Using the Windows 2000 support tools I use Active Directory Site and Services. Expand “Sites”, Expand the site you want to replicate with, Expand Servers, Expand the server(s) that you want to replicate with, Expand NTDS Settings, Right click on the connection (typically “” and choose “Replicate Now”
Do this for all of the sites and/or servers that need the replicated data.

Thursday, August 10, 2006

Creating Themes for Adenium Systems Document Fulfillment System©

Why?

One would create themes for DFS for a couple of reasons.

1.A customer is requesting special Graphics, logos, text, anything out of the ordinary.

2.For testing purposes. Every theme in DFS is separate from the other themes. This will allow you to keep an untouched copy, typically “dfstheme”. We do not run any portals out of “dfstheme”, instead we run most of them out of “DFS”, with a few customer that have their own theme, and I have my development theme, with its own fake company for development and testing.

How

First you copy all of the files from /dfstheme to a new folder named whatever you want the new theme to be called. Then you go into “Internet Services Manager”, expand the Default Web site if that is where the theme is stored. Right click on the folder and go to “Properties”. In the “Application Name” area of that window click the “Create” button to create an application. Then click on the “ASP.NET” tab. Make sure that the “ASP.NET version” is set to a least 2.0.50727.

Next copy and paste this script into Microsoft SQL Query Analyzer

::Code::

-- Dumping data for table 'Portal_Themes'—

INSERT INTO Portal_Themes (Id, Status, Display_Name, Description, URL, App_Name, APP_Startup_Page, Internal_IP)

VALUES('NEWDFSTHEME', 1, 'Plans Direct Theme', 'Description', 'http://localhost/', 'NEWDFSTHEME', 'Default.aspx', 'localhost')

GO

-- Dumping data for table 'Portal_Theme_Elements'--

INSERT INTO Portal_Theme_Elements (Id, Portal_Theme_Id, Display_Name, Description, Element_Name, Element_Type, Sequence)

VALUES('NEWDFSTHEME_CONTENT_AREA', 'NEWDFSTHEME', 'Content', 'Content Area', 'ContentArea', 3, 8)

GO

INSERT INTO Portal_Theme_Elements (Id, Portal_Theme_Id, Display_Name, Description, Element_Name, Element_Type, Sequence)

VALUES('NEWDFSTHEME_DESCRIPTION', 'NEWDFSTHEME', 'Description', 'Description Text', 'DescriptionTxt', 1, 9)

GO

INSERT INTO Portal_Theme_Elements (Id, Portal_Theme_Id, Display_Name, Description, Element_Name, Element_Type, Sequence)

VALUES('NEWDFSTHEME_ERROR_TEXT', 'NEWDFSTHEME', 'Error Text', 'Error Text', 'ErrorTxt', 1, 1)

GO

INSERT INTO Portal_Theme_Elements (Id, Portal_Theme_Id, Display_Name, Description, Element_Name, Element_Type, Sequence)

VALUES('NEWDFSTHEME_PAGEHEADER_AREA', 'NEWDFSTHEME', 'Page Header', 'Page Header Area', 'PageheaderArea', 3, 4)

GO

INSERT INTO Portal_Theme_Elements (Id, Portal_Theme_Id, Display_Name, Description, Element_Name, Element_Type, Sequence)

VALUES('NEWDFSTHEME_PRIMARY_AREA', 'NEWDFSTHEME', 'Primary Area', 'Primary Area', 'PrimaryArea', 3, 5)

GO

INSERT INTO Portal_Theme_Elements (Id, Portal_Theme_Id, Display_Name, Description, Element_Name, Element_Type, Sequence)

VALUES('NEWDFSTHEME_PRODUCT_TITLE', 'NEWDFSTHEME', 'Product Title', 'Product Title', 'ProductTitleTxt', 1, 10)

GO

INSERT INTO Portal_Theme_Elements (Id, Portal_Theme_Id, Display_Name, Description, Element_Name, Element_Type, Sequence)

VALUES('NEWDFSTHEME_SECONDARY_AREA', 'NEWDFSTHEME', 'Secondary Area', 'Secondary Area', 'SecondaryArea', 3, 6)

GO

INSERT INTO Portal_Theme_Elements (Id, Portal_Theme_Id, Display_Name, Description, Element_Name, Element_Type, Sequence)

VALUES('NEWDFSTHEME_TABLE_COL_HDR_TEXT', 'NEWDFSTHEME', 'Column Header Text', 'Table Column Header Text', 'TableColumnHeadTxt', 3, 7)

GO

INSERT INTO Portal_Theme_Elements (Id, Portal_Theme_Id, Display_Name, Description, Element_Name, Element_Type, Sequence)

VALUES('NEWDFSTHEME_SEARCH_AREA', 'NEWDFSTHEME', 'Search Area', 'Search Area Background Color', 'SearchArea', 3, 8)

GO

::End Code::

Now when you go into DFS Library Manager you should see your new theme as an option for any existing Portals or any New portals.

Download SQL Script

Wednesday, August 09, 2006

The Beauty of Active Directory Sites

The real beauty of Sites in Microsoft Active Directory is the ability to change replication times and Group Policy Objects.

We are a small company with around 30 employees TOTAL. Most share computers and few have private log-ins. Not much changes in any office, so why update the other Domain Controllers every three hours? My point exactly. Currently set up is an 8 hour replication time with 10am to 2pm not available for replication Monday through Friday. Saturday and Sunday is not available the entire day due to Offsite backups.

We have four offices, with three of them not staffed by IT. This means that when we get a chance to get out of the office and visit these other offices there are always more problems than reported and WE come under prepared for the tasks.

Currently in development is locking down these other offices to the point of doing their respective jobs, but not to the point of being the “All seeing Big Brother”. Spyware is our biggest problem followed by time wasting internet surfing, especially to Poker sites.

Active Directory allows me to set Group Policy on these other sites to disallow certain things and force certain things. One of the things that I force is Automatic Updates. Currently set to download and install every day at 3am. Also set to look at our Microsoft Windows Server Update Services Server.