How to Run Performance counter when Available RAM is Below threshold

Here, you will learn how to execute Performance counters once configured Alert reached below/above threshold value. I am configuring alert for RAM and trying to capture the performance counter report of running processes when memory will go below threshold value. Performance counter to monitor the performance will be triggered off  automatically once value reached below threshold. To do so, we will first create Alert in Perfmon to monitor the threshold value of RAM and then create counters for running process.

With this scenario, we will be able to find the list of processes running when RAM goes below threshold value. You can configure performance counters as per your requirement.

Lets go!!! Steps are given below.

1. Open Perfmon.
2. Create Alert for threshold value of RAM.



Here, we will select second option to create Alert for Memory.



Here, Add counter which you want to monitor, I am using Available memory(MB) to monitor Physical memory.


Configure the threshold value(Limit) for Available memory, I am using below 250 MB.



3. Create Performance counter for Process




Configure required counters. I am using Process to monitor, make sure select only "<All instances>" (as shown in below fig.) instead of selecting all process as I have to capture all the running processes when memory went to below threshold.




4. Now both alter and counters have been configured. Now, we have to configure Alert so that required performance can be triggered off once value reached to threshold value.

5. Go to Property of Alert and click Alert Action tab then select data collector name as created above.

6. Once all done, start only Alert. It will monitor the memory threshold value and once reached; it will triggered off  performance counters to monitor the running process.

I have explained logic which can be used as per requirement. I have done this to capture the running processes performance counters when threshold value of memory reaches below to 250 MB.

Same can be done to CPU as well..........

Script to list larger size folder with owner detail

Script is modified by me as per my requirement. It is parameter based script. Example is given below.

cscript folder.vbs "C:\Program Files" 1GB

Above execution will search folder larger than 1 GB in Program Files along with owner.

--------------------------------
Path = WScript.Arguments.Item(0)
Data1 = WScript.Arguments.Item(1)
Format = UCase(Right(Data1,2))
Data = Left(Data1,Len(Data1)-2)
Set objWMIService = GetObject("winmgmts:")
If Format <> "GB"And Format <> "MB"Then
MsgBox"Data Format Error!!! Please correct"
WScript.Quit
EndIf
Dim fso
Dim ObjOutFile
'Creating File System Object
Set fso = CreateObject("Scripting.FileSystemObject")

'Create an output file
Set ObjOutFile = fso.CreateTextFile("c:\Output.csv")

'Writing CSV headers
If Format = "GB"Then
ObjOutFile.WriteLine("Type,Folder Name,Path,Size(GB), Owner")
Else
ObjOutFile.WriteLine("Type,Folder Name,Path,Size(MB), Owner")
EndIf

'Call the GetFile function to get all files
GetFiles(Path)

'Close the output file ObjOutFile.Close
WScript.Echo("Completed")

Function GetFiles(FolderName)
OnErrorResumeNext
Dim ObjFolder
Dim ObjSubFolders
Dim ObjSubFolder
Set ObjFolder = fso.GetFolder(FolderName)
'Getting all subfolders
Set ObjSubFolders = ObjFolder.SubFolders

ForEach ObjFolderIn ObjSubFolders
'Writing SubFolder Name and Path
If Format = "GB"Then
    Size=Round(((ObjFolder.Size)/(1024*1024*1024)),2)
EndIf
If Format = "MB"Then
    Size=Round(((ObjFolder.Size)/(1024*1024)),2)
EndIf
If Size > Int(data) Then
strFolderName = ObjFolder
WScript.Echo strFolderName
Set objFileSecuritySettings = objWMIService.Get("Win32_LogicalFileSecuritySetting='" & strFolderName & "'")
intRetVal = objFileSecuritySettings.GetSecurityDescriptor(objSD)
WScript.Echo objSD.Owner.Name
If intRetVal = 0Then
   ObjOutFile.WriteLine(ObjFolder.Type & "," & ObjFolder.Name & "," & ObjFolder.Path & "," & Size & "," & objSD.Owner.Domain & "\" & objSD.Owner.Name )
Else
   ObjOutFile.WriteLine(ObjFolder.Type & "," & ObjFolder.Name & "," & ObjFolder.Path & "," & Size & ", Unable to find")
EndIf
EndIf
'Getting all Files from subfolder
GetFiles(ObjFolder.Path)
Next
EndFunction

Script to list larger files with owner detail

Script is modified by me as per my requirement. It is parameter based script. Example is given below.

cscript file.vbs "C:\Program Files" 1GB


Above execution will search file larger than 1 GB in Program files along with owner.


--------------------------------

Path = WScript.Arguments.Item(0)
Data1 = WScript.Arguments.Item(1)
Format = UCase(Right(Data1,2))
Data = Left(Data1,Len(Data1)-2)
Set objWMIService = GetObject("winmgmts:")
If Format <> "GB"And Format <> "MB"Then
MsgBox"Data Format Error!!! Please correct"
WScript.Quit
EndIf
Dim fso
Dim ObjOutFile
'Creating File System Object
Set fso = CreateObject("Scripting.FileSystemObject")

'Create an output file
Set ObjOutFile = fso.CreateTextFile("c:\Output.csv")

'Writing CSV headers
If Format = "GB"Then
ObjOutFile.WriteLine("Type,File Name,File Path,Size(GB), Owner")
Else
ObjOutFile.WriteLine("Type,File Name,File Path,Size(MB), Owner")
EndIf

'Call the GetFile function to get all files
GetFiles(Path)

'Close the output file ObjOutFile.Close
WScript.Echo("Completed")

Function GetFiles(FolderName)
OnErrorResumeNext
Dim ObjFolder
Dim ObjSubFolders
Dim ObjSubFolder
Dim ObjFiles
Dim ObjFile
Set ObjFolder = fso.GetFolder(FolderName)
Set ObjFiles = ObjFolder.Files

'Write all files to output files
ForEach ObjFileIn ObjFiles

If Format = "GB"Then
    Size=Round(((ObjFile.Size)/(1024*1024*1024)),2)
EndIf
If Format = "MB"Then
    Size=Round(((ObjFile.Size)/(1024*1024)),2)
EndIf
If Size > Int(data) Then
strFileName = ObjFolder & "\" & ObjFile.Name
WScript.Echo strFileName
Set objFileSecuritySettings = objWMIService.Get("Win32_LogicalFileSecuritySetting='" & strFileName & "'")
intRetVal = objFileSecuritySettings.GetSecurityDescriptor(objSD)
WScript.Echo objSD.Owner.Name
If intRetVal = 0Then
   ObjOutFile.WriteLine(ObjFile.Type & "," & ObjFile.Name & "," & ObjFile.Path & "," & Size & "," & objSD.Owner.Domain & "\" & objSD.Owner.Name )
Else
   ObjOutFile.WriteLine(ObjFile.Type & "," & ObjFile.Name & "," & ObjFile.Path & "," & Size & ", Unable to find")
EndIf
EndIf
Next

'Getting all subfolders
Set ObjSubFolders = ObjFolder.SubFolders

ForEach ObjFolderIn ObjSubFolders
GetFiles(ObjFolder.Path)
Next
EndFunction

Script to find files and save in CSV format



This is a parameter based script. Syntaxes are given below.



cscript filesearch.vbs "path needs to search" size(MB or GB)

Example:
Below command will search list of file which are larger than 1 GB in "C:\Program Files" Path and stored in C:\Output.csv

cscript filesearch.vbs "c:\program files" 1GB

--------------------------------
Path
 = WScript.Arguments.Item(0)
Data1 = WScript.Arguments.Item(1)
Format = UCase(Right(Data1,2))
Data = Left(Data1,Len(Data1)-2)

If Format <> "GB"And Format <> "MB"Then
MsgBox"Data Format Error!!! Please correct"
WScript.Quit
EndIf
Dim fso
Dim ObjOutFile
'Creating File System Object
Set fso = CreateObject("Scripting.FileSystemObject")

'Create an output file
Set ObjOutFile = fso.CreateTextFile("c:\Output.csv")

'Writing CSV headers
If Format = "GB"Then
ObjOutFile.WriteLine("Type,File Name,File Path,Size(GB)")
Else
ObjOutFile.WriteLine("Type,File Name,File Path,Size(MB)")
EndIf

'Call the GetFile function to get all files
GetFiles(Path)

'Close the output file ObjOutFile.Close
WScript.Echo("Completed")

Function GetFiles(FolderName)
OnErrorResumeNext
Dim ObjFolder
Dim ObjSubFolders
Dim ObjSubFolder
Dim ObjFiles
Dim ObjFile
Set ObjFolder = fso.GetFolder(FolderName)
Set ObjFiles = ObjFolder.Files

'Write all files to output files
ForEach ObjFileIn ObjFiles

If Format = "GB"Then
    Size=Round(((ObjFile.Size)/(1024*1024*1024)),2)
EndIf
If Format = "MB"Then
    Size=Round(((ObjFile.Size)/(1024*1024)),2)
EndIf
WScript.Echo FolderName
If Size > Int(data) Then
ObjOutFile.WriteLine(ObjFile.Type & "," & ObjFile.Name & "," & ObjFile.Path & "," & Size)
EndIf
Next

'Getting all subfolders
Set ObjSubFolders = ObjFolder.SubFolders

ForEach ObjFolderIn ObjSubFolders
GetFiles(ObjFolder.Path)
Next


EndFunction

Note: Script is only modified by me as per my requirement.

Script to clear the Dell OMSA Hardware log

' Export Hardware log of OMSA, Then clear the log.

Const CONVERT_TO_LOCAL_TIME = True
Dim shell
Set shell = CreateObject("WScript.Shell")
Set dtmStartDate = CreateObject("WbemScripting.SWbemDateTime")
Set dtmEndDate = CreateObject("WbemScripting.SWbemDateTime")
DateToCheck = Date
dtmStartDate.SetVarDate DateToCheck, CONVERT_TO_LOCAL_TIME
dtmEndDate.SetVarDate DateToCheck + 1 , CONVERT_TO_LOCAL_TIME
'Script.echo dtmStartDate
'Script.echo dtmEndDate
file = Date
filetxt = Replace(file,"/","")
'Script.echo "c:\" & filetxt & ".cvs"
strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colEvents = objWMIService.ExecQuery _
    ("Select * from Win32_NTLogEvent Where TimeWritten >= '" _
        & dtmStartDate & "' and TimeWritten < '" & dtmEndDate & "' And Logfile = 'System' And EventCode = '7036'")
i=0
For Each objEvent in colEvents
If objEvent.EventCode = 7036 Then
 If i =0 Then
     WScript.Echo "Event Type: " & objEvent.Type
     shell.Run "omreport.exe system esmlog -outc c:\" & filetxt & ".csv"
     shell.Run "omconfig.exe system esmlog action=clear"
     i=i+1
    End If
End If
Next

How to Root Android

Warrning : Your warranty may void after Root.

Android is built upon the Linux operating system, there is a concept of an administrator user knows as "root" that has full permissions to the system. When you "root" a phone, you are enabling access to the root user so you can call on that user to access protected functionality.

Software required to Root Android.

1. Download jdk 32bit only from here.
2. Android sdk from here.
3. Unlock root from here
4. Create adb_usb.ini         /*Below are the step mentioned*/ 
5. Android phone drivers.

Create adb_usb.ini

Open notepad and type below mentioned lines then save it as "adb_usb.ini"


# ANDROID 3RD PARTY USB VENDOR ID LIST -- DO NOT EDIT.
# USE 'android update adb' TO GENERATE.
# 1 USB VENDOR ID PER LINE.

0x1c9e


Now everthing done, its time to Root your phone.

1. Install jdk
2. Install Android sdk to C drive, after installing open sdk manager form star and select "android sdk platform-tools" and "google usb driver" unselect the rest, click install packages. After installing put the adb_usb.ini file in 

"C:\Users\(your PC name)\.android"                              /*Window Vista or 7 user*/
"C:\Documents and Settings\(your PC name)\.android"     /*Window XP*/

3. Now enable usb debugging in your phone. Settings>applications>development>enable usb debugging and connect usb cable. A little green android icon on the topleft (if not then reinsert cable or re enable usb debugging)
4. Install your Adroid phone driver.
5. Now goto start type "device manger" open device manager, you will find "android adb interface".

6. Open cmd and do following things over there.

cd C:\android-sdk\platform-tools
adb devices                         /*Command list you devices or not something missed*/
adb shell                             /*Now you are connect shell of Android OS installed in your Ph*/
su                                      /*Now you have root access on your Phone*/

7. Install Unlock root, open it and click root, it wil ask for the device select Your phone model and Your done !!! :) :) :)


Note: Please don't close cmd untill your phone rooted.

Do let me know if I have missed. 

Ports

In computer port is refer to either physical or virtual connection points.

Physical ports allow connection between computer, routers, modems and other devices via connecting cables. Below are the examples of Physical ports.

  • Ethernet ports
  • USB ports
  • serial ports  
While Virtual ports allow connection between application or protocols. In general term we can say Virtual ports are part of TCP/IP networking. These ports allow software applications to share hardware resources without interfering with each other. Below are the examples of virtual ports with associate application or protocol.

  • 21/20   FTP
  • 23        Telnet
  • 80        HTTP 
What is necessity of virtual ports in computer world?

Answer is here, there are lot of application running on computer which uses TCP/IP for its communication via Ethernet Port but they can’t communicate with each other with out virtual port. Suppose computer A having “192.168.0.1” running IIS as a application and computer B want to communicate with IIS application of computer A. Computer B known, Computer A is reachable via address “192.168.0.1” but don’t know how to reach IIS application. To make it ease IANA has defined virtual ports. Now if we defined port number 80 to IIS application then problem will be solved. Now, IIS application of computer A is reachable by computer B as Computer B knows whom to contact after reaching address “192.168.0.1”.

You can open/close the port either installing/starting application/services on computer. 65535 numbers of virtual ports are used in computer world.

The port numbers are divided into three ranges: the Well Known Ports, the Registered Ports, and the Dynamic and/or Private Ports.

  • The Well Known Ports are those from 0 through 1023.
  • The Registered Ports are those from 1024 through 49151.
  • The Dynamic and/or Private Ports are those from 49152 through 65535

Refer:  services file @ C:\Windows\System32\drivers\etc to know which port is associated with which application\protocol.

We can control the communication of ports through Firewall which can be Hardware or Software. Below are few examples/commands to check whether is running or not.

1. Telnet is the universal command which is used to check the status of port. Suppose I have to check whether RDP port 3389 is running or not on Computer B.

Open “CMD” and type “telnet computer_name or computer_ip 3389“

User netstat /? – To know more about netstat

2. Netstat is the command can be use to check the status of open/communication port of localhost. It will show information all alive ports running on local computer.

Open “CMD” and type netstat –a

User netstat /? – To know more about netstat

Note : Please correct if I am wrong anywhere :)