Monthly Archives: June 2009

CustomeService

Dear All

Here is the document to create Service for any EXE file in Windows 2003 Server

http://itinfrablog.mkcl.org/wp-content/uploads/serverinfra/resource/Create+service.swf

Leave a comment

Filed under General

Memory_Monitor

Dear All

 

Following script can be scheduled on server to run after every 5 minutes which will monitor the free RAM on server and if RAM free RAM goes below 256mb then it wll send email.

 

dim str,mess
str="."
Check_Available_Virtual_Memory str,256

Function Check_Available_Virtual_Memory(strComputer,strThresholdMB)
dim wbemServices,wbemObjectSet,wbemObject,AvailableVMB,strStatus
Check_Available_Virtual_Memory=false
EXPLANATION = "Failed, error getting values."

Set wbemServices = GetObject("winmgmts:\\" & strComputer)
Set wbemObjectSet = wbemServices.InstancesOf("CIM_OperatingSystem")

For Each wbemObject In wbemObjectSet
AvailableVMB=int(wbemObject.FreePhysicalMemory/1024)
strStatus="Available Physical Memory=" & AvailableVMB & "mb, Threshold=" & strThresholdMB & "mb"

if AvailableVMB > strThresholdMB then
Check_Available_Virtual_Memory=true
EXPLANATION = "Success, " & strStatus
else
Check_Available_Virtual_Memory=false

EXPLANATION = "Failure, " & strStatus

dim j, NIC1, Nic, StrNic, lngCount, StrIP, i ,objNet,objHost
‘If something fails, move on
On Error Resume Next
‘Get the Computer’s network name
Set objNet=CreateObject("wscript.Network")
objHost=objNet.ComputerName
‘Wscript.Echo "Analysis of " & objHost & "."

‘Get a connection to the WMI NetAdapteConfig object
Set NIC1 = GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")

‘For Each of the NICs in the connection
dim ip
ip=""
For Each Nic in NIC1
   ‘Get the Adapter Description
   StrNIC = Nic.Description
     ‘If IP is enabled on the NIC then let’s find out about the NIC
     IF Nic.IPEnabled THEN
        lngCount=UBound(Nic.IPAddress)
        For i=0 to lngCount
           If i >= 0 Then
           StrIP = vbTab & Nic.IPAddress(i)
           If StrIP <> "" Then

if ip<>"" then
ip=ip+" | "+  StrIP
else
    ip=   StrIP
end if
                  End If
              End If
            Next
          END IF
      Next
mess="Hi , Please check that the server ip :-"+ ip + " | The availabe RAM is less than 256 mb only , Current Memory Status is : – "+ StrStatus
SendMail "prashantd@mkcl.org", "prashantd@mkcl.org " , "Physical Memory Alert (RAM)"  , Mess

end if
Next
end function
wscript.quit

Sub SendMail(Sender, Recipient, Subject, Message)

Const MailServer = "127.0.0.1" ‘ Mail Server to use (SMTP)
Const MailServerPort = "25" ‘ SMTP Port used at Mail server (25 is default)

Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = Subject
objMessage.From = Sender
objMessage.To = Recipient
objMessage.TextBody = Message

objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2

‘Name or IP of Remote SMTP Server
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserver") = MailServer

‘Server port (typically 25)
objMessage.Configuration.Fields.Item _
("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = MailServerPort

objMessage.Configuration.Fields.Update

objMessage.Send
End Sub

 

Thanks

 

Prashant Deshpande

 

Leave a comment

Filed under ServerMonitoring

Hobocopy

Dear All

 

Please find here with the Demo of HOBOCOPY ( open source software ) to take backup of Open Files.

 

Click for Demo

 

Thanks

 

Prashant Deshpande

 

 

Leave a comment

Filed under Backup

Combofix

 

Dear All

Today morning i got  call from Preeti Madam (Delhi), she was facing an problem that when she is opening the IE she is getting redirected to  http://flex.host-care.com/suspended.page and after changing the default website also redirecting to same site. ( Its was Browser Hijack Isuue)

Please find here with solution that i have tried and it has worked.

 http://itinfrablog.mkcl.org/wp-content/uploads/itsupp/resource/combofix.docx

Thanks

Prashant Deshpande

Leave a comment

Filed under General

EVentlog_Notify

 

http://itinfrablog.mkcl.org/wp-content/uploads/serverinfra/resource/Scripts.zip

Dear All

Please find here with the Server Event Logs Senderscripts

When any server goes down , after restart we use to take remote of that server and then read the event logs for getting shutdown causes

here is the attached rar file which contains following Files

1)BackupEvt.vbs :- which will take backup of all Event logs

2) Create_rar.bat :- which will make zip of the backup of event log taken by BackupEvt.vbs

3) SendevtLog.vbs :- which will send the Zip of event log backup

4)Writeeventlogs.vbs :-write event logs in Text file

Detailed procedure of configuring

  Folder structure to be available

   c:\Scripts :-> wil contains all Scripts

  c:\evtlogs :- will be used for writing logs

  d:\zip :- will be used to store backup of event logs in RAR format

  1) In task schedular configure a task for writeeventlogs.vbs whcih will be getting called after every 24 hrs

  2)See to it that server/ System has installed 7-Zip and path includes it

  3) Strat -> Run –> gpedit.msc

    In computer Configuration –> Windows Settings –> Scripts –> Startup

specify the two scripts 1) Writeeventlogs.vbs

                                   2) SendevtLog.vbs

after this configuartion whenever that system / Server will get restarted it will send email notification along with the backup of event logs in RAR format to the email ids present in sendevtlogs.vbs ( change email ids as per requirement )

 

Thanks

 Prashant Deshpande

Leave a comment

Filed under ServerMonitoring

Custon Service Creation

Dear All

Please find documentation for how to create our own windows service in Windows 2003 Server for any EXE file.

Click for Demo

Leave a comment

Filed under General