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 :)

Log Files required troubleshooting the Window 7 installation

Lot of time we are unable to install the OS on fresh Computer, we do lot of tries but no luck and we don’t know what to do next, how to dig the issue, which/where to find the logs.
Here is the key to solve failures is identifying where you are in the installation process and when a failure occurs. As you are creating a new installation, the hard drive is not present initially, Windows Setup writes logs into memory, specifically in a Windows PE session (X:\Windows). When hard drive ready to use after formatting, Setup continues logging directly onto the new hard drive (C:\Windows). Whatever Log files created during the Windows PE session are temporary.


Windows Setup Scenario




When a failure occurs in Windows Setup, review the entries in the Setuperr.log file, then the Setupact.log file, and then other log files as appropriate.

Log file
Description
Location
Setupact.log
Primary log file for most errors that occur during the Windows installation process. There are several instances of the Setupact.log file, depending on what point in the installation process the failure occurs. It is important to know which version of the Setupact.log file to look at, based on the phase you are in.
Setup (specialize): X:\Windows\panther
Setup (OOBE), LogonUI, OEM First Run:%windir%\panther
Windows Welcome (OOBE): %windir%\panther\unattendGC
Setuperr.log
High-level list of errors that occurred during the specialize phase of Setup. The Setuperr.log file does not provide any specific details.
Setup (specialize): %windir%\panther
Setup (specialize): %windir%\panther
Setup (OOBE), LogonUI, OEM First Run: %windir%\panther
Setupapi.offline.log
Driver failures during the Component Specialization sub-phase of the Setup specialize phase.
%windir%\inf
Cbs_unattend.log
Unattended-setup servicing failures.
%windir%\panther
Setupapi.dev.log
Driver failures during the oobe phase of Setup.
%windir%\inf
Sessions.xml
An XML-based transaction log file that tracks all servicing activity, based on session id, client, status, tasks, and actions. If necessary, the Sessions.log file will point to the DISM.log and CBS.log files for more details.
%windir%\servicing\sessions
CBS.log
Servicing log file that provides more details about offline-servicing failures.
%windir%\Panther



OOBE - Out-of-box experience is the first impressions a user has with a product when opening its packaging and taking it into use. For software, it is "Welcome Screen" or "Initial Configuration" wizard screens that simplify elaborate set-up of the software
As an example, the process of installing Microsoft Windows is OOBE.  Whatever steps we do during installation comes in OOBE - to acknowledge software license terms, specify partition to install OS, "product key" etc.


Note: Information is gathered from Technet.