DBA and SysAdmin World

May 23, 2009

SharePoint 2003 "Alert Me" does not work

Filed under: Problem, System Administrator — Tags: , , — solihinho @ 11:02 PM
SharePoint 2003 Issue
Our user suddenly raised an issue that she never got an alert anymore from her department portal if any changes happened on the document list. We’ve checked the SMTP etc and looks like it was working fine. Honestly we as SharePoint Administrator did not know how the way this alert works. So the last way we coulddo was asking for help from Microsoft support Big Grin.

Things need to be checked
Microsoft support asked us to do several things for investigating this issue. From this we also knew how SharePoint’s alert actually works.

1. Check whether we can get the first notification mail from SharePoint when we subscription “Alert me”.

2. Check whether we will get a new record in content database.
    · Actually, once we done some modification in library or list, the system will insert 
      a new record in database for "Mail Alert".
    · We can run the following command to check whether this record has be inserted to DB :
        SELECT * FROM dbo.EventCache ORDER BY eventtime DESC

3. Then, SharePoint timer job service will read the data from DB and send mail out.
    · NOTE : The timer job service will run every 5 minutes by default.
    · We also can run the following command to check it.
        Stsadm –o getproperty –propertyname job-immediate-alerts

4. After that, the record will be deleted from content database.

Problem Solve
From that guidance, we just realized that our SharePoint Timer service was off. After turned it on, the alert back to normal. If the guidance doesn’t help on your problem. It should be another component that you need to check such as the SMTP server etc.


November 5, 2008

How to Change Mac Address on Windows

Filed under: System Administrator — Tags: , — solihinho @ 11:55 PM
ipconfig What is MAC Address?
Media Access Control Address (MAC Address) according to wikipedia is a quasi-unique identifier assigned to most Network Interface Card (NIC). This address is commonly written as 12 digits Hexadecimal e.g. : 00-12-3F-3B-B2-51. To check your mac address, from Windows Command Prompt type ipconfig/all. Look at on Physical Address section. You will find 12 digits hexadecimal.

Why I Need to Do This?
In my case, I need to change my computer MAC Address because the Internet Service Provider only permit computer with MAC Address already registered able to connect to Internet. If I need to swap between my computers, I have to call the call center and ask them to flush it. It would be a lot easier if I have the same MAC Addresses between my PC and laptop.

Step by Step
To be able change the MAC Address, it depend on the type of the NIC that you have. I can do it on my laptop but not on my PC. The friend of mine told me the step by step to do this.

  1. go to Control Panel
  2. double click on Network Connections
  3. right click on the NIC that you want to change (in case you have more than 1 NIC), click Properties
  4. Under General tab, click Configure button
  5. click on Advanced tab
  6. on the Property list, just look for Network Address item
    If this item doesn’t appear, probably the NIC doesn’t support to change the MAC Address value.
    But if you can see this item, click on it. Just type the value that you want on the value textbox without “-” between MAC Address number e.g.: 00123F3BB251 for 00-12-3F-3B-B2-51
  7. check the MAC Address with ipconfig/all
  8. if successful, reboot your computer

October 10, 2008

Catalog Error – Error Code 800401E4 – Invalid Syntax

Filed under: Problem — Tags: — solihinho @ 10:49 PM


Today after unregistered and register COM+ on our server, when I tried to start the COM+ there is an error message “Error Code 800401E4 – Invalid Syntax“. I tried to restart the server but the problem still occurred. When I search this keyword on google, thanks GOD I found the solution Whew.

I’ve got solution here.

1. Added the following key and value as noted below : KEY_CLASSES_ROOT\CLSID\CLSID
2. Set it's (Default) REG_SZ value to {0000031A-0000-0000-C000-000000000046}

It works for my problem.

October 4, 2008

Check Disk Space Using WMI

Filed under: System Administrator — Tags: , — solihinho @ 7:45 PM


One of System Administrator responsibility is to make sure that the server has enough disk free space. This task should be include on System Administrator daily check list which is mean as a System Administrator we have to do this everyday. Run of disk space can make the server doesn’t work properly. By do this everyday, we will know if there is any process that eat a lot of space on the disk. Keep your server clean from file that was not useful also make your backup smaller.

There are several ways to check disk free space:
1. Remote to the server and use windows explorer
free space using windows explorer

2. Using computer management
computer management
The advantage from this method than before is we don’t need to remote to server directly. We can use computer management from our local PC, right click on the computer management and enter the server name that we want to check. As long as our user have a right on that server it should be no issue.

3. Create a script using WMI (Windows Management Instrumentation)
According microsoft.com, the purpose of WMI is the infrastructure for management data and operations on Windows-based operating systems. You can write WMI scripts or applications to automate administrative tasks on remote computers.

Since we have to check server disk space everyday, I think a better way is make it automatically. We can create the script so just run this script to monitor many server or schedule the script using windows schedule task. It is more efficient than method 1 and 2.

Win32_LogicalDisk Class
is WMI class represents a data source that resolves to an actual local storage device on a computer system running Windows. Further information just visit msdn.microsoft.com

I wrote this script using vbscript. It include 2 files. 1st is .vbs file and 2nd is setting.ini file. The result of this script is written to excel file (see below picture). I’ve tried running this script both on office 2003 and 2007. To activate the send email feature (change SentEmail on setting.ini become true), you have to install IIS and CDONT on the computer that run this script.



' This script to get drive space
' Revision history :
'	Solihin - 18 July 2008 - Initial Coding
'               solihinho.wordpress.com

Option Explicit
Dim objWMIService, objItem, colItems
Dim strDriveType, strDiskSize, strDisk
Dim strServer, strListServer
Dim sReportTitle
Dim sFileName, sScriptPath
Dim sEmailTo, sEmailFrom, sEmailSubject, sEmailBody
Dim oFso
Dim sQuery

'On Error Resume Next

'Init Variable
strListServer = ReadIni("setting.ini", "ServerList", "Name")
sReportTitle  = "Report Space Drive Information"
strServer = Split(strListServer,",")
sQuery = "SELECT * FROM Win32_LogicalDisk"

Set oFso = CreateObject("Scripting.FileSystemObject")
sFileName  = ReadIni( "setting.ini", "Excel", "FileName")

'Write and format result file
sScriptPath = Left(WScript.ScriptFullName, InstrRev(WScript.ScriptFullName, ""))
sFilename = sScriptPath & sFilename

'delete file if exists
If oFso.FileExists(sFilename) then
  oFso.DeleteFile sFilename, True
end If

FormatXLS (sFileName)

Dim oExcel, oWb, oSheet, oRange
Dim iRow, iStartRow
Dim compName

If ReadIni( "setting.ini", "Email", "SentEmail" ) = "True" Then
  sEmailTo    = ReadIni( "setting.ini", "Email", "To" )
  sEmailFrom  = ReadIni( "setting.ini", "Email", "From" )
  sEmailSubject = ReadIni( "setting.ini", "Email", "Subject" )
  sEmailBody  = ReadIni( "setting.ini", "Email", "Body1") & vbcrlf &_
  ReadIni( "setting.ini", "Email", "Body2")
  SendMail (sFileName)
End If

'procedure write to excel
Sub FormatXLS (sFileName)

  'Create excel object, exit if object not exists
  Set oExcel = CreateObject("Excel.Application")
  If Err.Number <> 0 Then Exit Sub
  If IsNull(oExcel) Then Exit Sub
  oExcel.Visible = ReadIni( "setting.ini", "Excel", "IsVisible" )

  'Create a workbook
  Set oWb = oExcel.Workbooks.Add
  'Bind to worksheet
  Set oSheet = oExcel.ActiveWorkbook.Worksheets(1)
  oSheet.Name = "Local Drive"

  oExcel.Cells.EntireColumn.Font.Name = "Verdana"
  iRow = 1

  oSheet.Cells(iRow, 1).Value = sReportTitle
  iRow = iRow + 1
  oSheet.Cells(iRow, 1).Value = "Report Date : " & Date & " " & Time
  oSheet.Cells(iRow,1).Font.Size = 10
  oSheet.Cells(iRow,1).Font.Italic = True

  iRow = iRow + 2

  For Each compName In strServer

  Set objWMIService = GetObject ("winmgmts:\" & compName & "rootcimv2")
  Set colItems = objWMIService.ExecQuery (sQuery)

  oSheet.Cells(iRow, 1).Value = "Server : " & compName
  oSheet.Cells(iRow, 1).Font.Bold = True

  iRow = iRow + 1
  iStartRow = iRow

  'initiate column
  oSheet.Cells(iRow, 1).Value = "Drive"
  oSheet.Cells(iRow, 2).Value = "Drive Type"
  oSheet.Cells(iRow, 3).Value = "Disk Size"
  oSheet.Cells(iRow, 4).Value = "Disk Used"
  oSheet.Cells(iRow, 5).Value = "Free Space"
  oSheet.Cells(iRow, 6).Value = "% Free Space"

  Set oRange = oExcel.Range("A" & iRow, "F" & iRow)
  oRange.Font.Italic = True
  oRange.Interior.ColorIndex = 15	

  iRow = iRow + 1

  For Each objItem in colItems
    Select Case objItem.DriveType
      Case 1 strDriveType = "Drive could not be determined."
      Case 2 strDriveType = "Removable Drive"
      Case 3 strDriveType = "Local hard disk."
      Case 4 strDriveType = "Network disk."
      Case 5 strDriveType = "Compact disk (CD)"
      Case 6 strDriveType = "RAM disk."
      Case Else strDriveType = "Drive type Problem."
    End Select

    If IsNull(objItem.Size) Then
      strDiskSize = ""
    ElseIf objItem.DriveType = 2 Then
      strDiskSize = CDbl(FormatNumber(objItem.Size /1048576)) &_
            " Mega Bytes"
      strDiskSize = CDbl(FormatNumber(objItem.Size /1073741824,2)) & " GB"
    End If 

    If ObjItem.Size <> "" Then
      oSheet.Cells(iRow, 1).Value = objItem.Name
      oSheet.Cells(iRow, 2).Value = strDriveType
      oSheet.Cells(iRow, 3).Value = strDiskSize
      oSheet.Cells(iRow, 3).HorizontalAlignment = -4152 'xlRight
      oSheet.Cells(iRow, 4).Value = CDbl(FormatNumber((objItem.Size _
             - objItem.FreeSpace) / 1073741824)) & " GB"
      oSheet.Cells(iRow, 4).HorizontalAlignment = -4152 'xlRight
      oSheet.Cells(iRow, 5).Value = CDbl(FormatNumber(objItem.FreeSpace _
             /1073741824)) & " GB"
      oSheet.Cells(iRow, 5).HorizontalAlignment = -4152 'xlRight
      oSheet.Cells(iRow, 6).Value = CDbl(FormatNumber(objItem.FreeSpace _
             /objItem.Size * 100)) & " %"
      oSheet.Cells(iRow, 6).HorizontalAlignment = -4152 'xlRight

      iRow = iRow + 1
    End If
  Next 'End For

  Set oRange = oExcel.Range("A" & iStartRow & ":F" & iRow-1)
  With oRange.Borders(7) ' Left
    .Weight = 2 'xlThin
  End With
  With oRange.Borders(8) ' Top
    .Weight = 2
  End With
  With oRange.Borders(9) ' Bottom
    .Weight = 2
  End With
  With oRange.Borders(10) ' Right
    .Weight = 2
  End With
  With oRange.Borders(11) ' Inside Vertical
    .Weight = 2
  End With
  With oRange.Borders(12) ' Inside Horizontal
    .Weight = 2
  End With

  iRow = iRow + 1
Next 'End For

'set all colums autofit
Set oRange = oExcel.Range("A1")
oRange.ColumnWidth = 6

Set oRange = oExcel.Range("B1")
Set oRange = oExcel.ActiveCell.EntireColumn

Set oRange = oExcel.Range("C1")
Set oRange = oExcel.ActiveCell.EntireColumn

Set oRange = oExcel.Range("D1")
Set oRange = oExcel.ActiveCell.EntireColumn

Set oRange = oExcel.Range("E1")
Set oRange = oExcel.ActiveCell.EntireColumn

Set oRange = oExcel.Range("F1")
Set oRange = oExcel.ActiveCell.EntireColumn

'Save as excel file
oExcel.ActiveWorkbook.SaveAs sFileName, 1, "", "", False, False

Set oSheet = Nothing
Set oExcel = Nothing

End Sub

'procedure to send email
Sub SendMail(sFileName)
  'On Error Resume Next

  'Create email object, exit if object not exists
  Set oEmail = CreateObject("CDONTS.NewMail")
  If Err.Number <> 0 Then Exit Sub
  If IsNull(oEmail) Then Exit Sub

  'Send mail with attachment
  oEmail.From    = sEmailFrom
  oEmail.To      = sEmailTo
  oEmail.Bcc     = sEmailBcc
  oEmail.Subject = sEmailSubject
  oEmail.Body    = sEmailBody

  If oFso.FileExists(sFileName) Then
     oEmail.AttachFile sFileName
  ElseIf oFso.FileExists(sFileName) Then
     oEmail.AttachFile sFileName
  End If
  Set oEmail = Nothing
End Sub

Function ReadIni( myFilePath, mySection, myKey )
  ' This function returns a value read from an INI file
  ' Arguments:
  ' myFilePath  [string]  the (path and) file name of the INI file
  ' mySection   [string]  the section in the INI file to be searched
  ' myKey       [string]  the key whose value is to be returned
  ' Returns:
  ' the [string] value for the specified key in the specified section
  ' CAVEAT:     Will return a space if key exists but value is blank
  ' Written by Keith Lacelle
  ' Modified by Denis St-Pierre and Rob van der Woude

  Const ForReading   = 1
  Const ForWriting   = 2
  Const ForAppending = 8

  Dim intEqualPos
  Dim objFSO, objIniFile
  Dim strFilePath, strKey, strLeftString, strLine, strSection

  Set objFSO = CreateObject("Scripting.FileSystemObject")

  ReadIni     = ""
  strFilePath = Trim( myFilePath )
  strSection  = Trim( mySection )
  strKey      = Trim( myKey )

  If objFSO.FileExists( strFilePath ) Then
    Set objIniFile = objFSO.OpenTextFile( strFilePath, ForReading, False)
    Do While objIniFile.AtEndOfStream = False
      strLine = Trim( objIniFile.ReadLine )

      'Check if section is found in the current line
      If LCase( strLine ) = "[" & LCase(strSection) & "]" Then
        strLine = Trim( objIniFile.ReadLine)

        'Parse lines until the next section is reached
        Do While Left( strLine, 1 ) <> "["
          'Find position of equal sign in the line
          intEqualPos = InStr( 1, strLine, "=", 1 )
          If intEqualPos > 0 Then
            strLeftString = Trim(Left(strLine,intEqualPos - 1))

            'Check if item is found in the current line
            If LCase(strLeftString) = LCase(strKey) Then
              ReadIni = Trim(Mid(strLine, intEqualPos + 1))
              'In case the item exists but value is blank
              If ReadIni = "" Then
                ReadIni = " "
              End If
              'Abort loop when item is found
              Exit Do
            End If
          End If

          'Abort if the end of the INI file is reached
          If objIniFile.AtEndOfStream Then Exit Do

          'Continue with next line
          strLine = Trim( objIniFile.ReadLine )
       Exit Do
     End If
    WScript.Echo strFilePath & " doesn't exists. Exiting..."
    Wscript.Quit 1
  End If
End Function

Name = server1, server2

SentEmail  = False
From	  = AutomaticTask@YourDomain.com
To	  = Admin@YourDomain.com
Subject    = [report] Fixed Drive Free Space
Body1      = Dear Admin,
Body2      = Please find attached file to review  your server fixed drive free space.

FileName  = FreeSpaceReport.xls
isVisible = True

There is a book that review about WMI and how to utilize it become a tool that make some task of System Administrator can be automatically. You can modify above script with another WMI class. Schedule the script and if possible send the result by email. So every morning what System Administrator doing is just review the result instead of remote to each server and do some daily check list.

October 3, 2008

Cannot Delete NTUSER.dat

Filed under: Tools — Tags: , — solihinho @ 10:55 PM


Today when I tried to remove some user profiles on my server, I got an error message “Cannot delete NTUSER.dat: It is being used by another person or program”. I’ve checked if there is an application open this file, but I found nothing. I tried remove this file using an application called “ForceDelete.exe” but still could not delete this file.

You can download tool called “User Profile Hive Cleanup Service” from microsoft. I’ve tried to download and installed this tool in my server. After installation is finish,  navigate to C:\program files\UPHClean using windows explorer. Run the exe file than try to remove the profile again. It’s working for me Party.

September 13, 2008

Defragmentation Tools

Filed under: Tools — Tags: , — solihinho @ 10:27 AM
logo Issue
These few days, disk fragmentation on our servers become an important issue. Some case prove that when fragmentation occur, the backup on that server become more slowly than ever besides make your server/PC not in the best performance. Actually we have scheduled to defrag the C drive  every month using windows defrag command line. Unfortunately some drive still fragmented.

Recommended Tool
I found Defraggler, tool for defragmenting disk. This tool is very great. It can defrag not only whole disk, but it is also able defrag individual files. Some of my servers which is before can not be defrag with windows defrag tool, should be no issue with this tool. It also give visualization that allowing us to visually see the location of file on the disk. Last but not least, this tool is completely free for both corporate and individual use Applause. Just download from http://www.defraggler.com

Thank for Piriform Ltd for the nice tool Not worthy. Now I use this tool to defrag my PC and my laptop too.

df1 df4

September 12, 2008

System Administrator Command Line

Filed under: Tools — Tags: , , — solihinho @ 11:36 PM
images As a Windows 2K/2K3 System Administrator, there are some command lines that a we need to know to help us solving the problem or to show information of the server or network. Go to windows command prompt by type “cmd” from Start -> Run to go into console mode.

Here some command line that  is useful for a Windows System Administrator. Some command lines also exist in UNIX system.

  1. ping <hostname>
    i.e : ping www.yahoo.com
    When SA want to check if the server reachable over the network or not, ping should be the only command can be used. If there is a reply message that mean the connection to the server is OK but if there is message request time out, something wrong happen to that server connection. It can be caused by many matters like hardware failure, the network cable unplug, the server is down etc. You can add parameter -t to test connection to the server until you press ctrl+C.
  2. IPConfig/all
    This command used for display all current TCP/IP network configuration such as IP address, MAC Address etc.
  3. IPConfig/flushdns
    Purges the DNS Resolver cache.
  4. nbstat-a <hostnamename>
    Returns the NetBIOS name table and MAC address of the address card for the computer name specified. Few days ago, our network team ask  us to collect all our server’s MAC Address. There are 2 ways to do this task. We can do it by remote console to the server one by one and use command ipconfig/all or use NBTSTAT command from our local PC Cool.
  5. tasklist
    This command line for displays list of applications / processes currently running either a local or remote server. To display remote server processes use Tasklist /s <hostname>.
  6. taskkill
    This command used to end one or more processes. We can kill the process by the process id or image name. To further information used this command type taskkill/?.
  7. tracert <destination server>
    used to determine the route taken by packets across an IP network.
  8. nslookup
    to find various details relating to DNS. i.e :  when you type nslookup www.google.com, you can see the IP address that used by www.google.com. You can also type nslookup <IP Address> to  get the server name which is used that IP address.
  9. netstat
    displays the active TCP connections and ports on which the computer is listening.
IdeaMostly the command lines have a documentation for help us see what parameter that we can use on the command line. Just type command line/? i.e : taskkill/?

Create a free website or blog at WordPress.com.