Pages

Saturday, 16 June 2012

Extract the Binary from the Binary Table


1. Browse to Binary Table
2. Double click the data part of the binary which is to be extracted
3. Select option  "Write Binary data to file" depending
4. Provide the file location to be extracted in file name tab
5. select OK


We will get the extracted file in the desired location.

Friday, 15 June 2012

Get System Information - VBScript


Set oSystemSet = GetObject("winmgmts:").InstancesOf("Win32_ComputerSystem")


For Each oSystem in oSystemSet


 system_name = oSystem.Caption 
 system_type = oSystem.SystemType
 system_mftr = oSystem.Manufacturer
 system_model = oSystem.Model
Next


Set oProcSet = GetObject("winmgmts:").InstancesOf("Win32_Processor")


For Each oSystem in oProcSet
 proc_desc = oSystem.Caption 
 proc_mftr = oSystem.Manufacturer
 proc_mhz = oSystem.CurrentClockSpeed
Next


Set oBiosSet = GetObject("winmgmts:").InstancesOf("Win32_BIOS")


For Each oSystem in oBiosSet
      bios_info = oSystem.Version
Next


Set oZoneSet = GetObject("winmgmts:").InstancesOf("Win32_TimeZone")


For Each oSystem in oZoneSet
      loc_timezone = oSystem.StandardName
Next


Set oOSSet = GetObject("winmgmts:").InstancesOf("Win32_OperatingSystem")


For Each oSystem in oOSSet


 os_name = oSystem.Caption
 os_version = oSystem.Version
 os_mftr = oSystem.Manufacturer
 os_build = oSystem.BuildNumber
 os_dir = oSystem.WindowsDirectory
 os_locale = oSystem.Locale
 os_totalmem = oSystem.TotalVisibleMemorySize
 os_freemem = oSystem.FreePhysicalMemory
 os_totalvirmem = oSystem.TotalVirtualMemorySize
 os_freevirmem = oSystem.FreeVirtualMemory
 os_pagefilesize = oSystem.SizeStoredInPagingFiles


Next


sMsg = ("OS Name:  " & os_name & Chr(10))
sMsg = sMsg & ("Version:  " & os_version & " Build " & os_build & Chr(10))
sMsg = sMsg & ("OS Manufacturer:  " & os_mftr & Chr(10))
sMsg = sMsg & ("oSystem Name:  " & system_name & Chr(10))
sMsg = sMsg & ("oSystem Manufacturer:  " & system_mftr & Chr(10))
sMsg = sMsg & ("oSystem Model:  " & system_model & Chr(10))
sMsg = sMsg & ("oSystem Type:  " & system_type & Chr(10))
sMsg = sMsg & ("Processor:  " & proc_desc & " " & proc_mftr & " ~" & proc_mhz & "Mhz" & Chr(10))
sMsg = sMsg & ("BIOS Version:  " & bios_info & Chr(10))
sMsg = sMsg & ("Windows Directory:  " & os_dir & Chr(10))
sMsg = sMsg & ("Locale:  " & os_locale & Chr(10))  
sMsg = sMsg & ("Time Zone:  " & loc_timezone & Chr(10))
sMsg = sMsg & ("Total Physical Memory:  " & os_totalmem & "KB" & Chr(10))
sMsg = sMsg & ("Available Physical Memory:  " & os_freemem & "KB" & Chr(10))
sMsg = sMsg & ("Total Virtual Memory:  " & os_totalvirmem & "KB" & Chr(10))
sMsg = sMsg & ("Available Virtual Memory:  " & os_freevirmem & "KB" & Chr(10))
sMsg = sMsg & ("Page File Space : " & os_pagefilesize & "KB" & Chr(10))


MsgBox sMsg, 0,"System Summary Information"

Get Serial Number of Operating system Installed - VBScript


Set SNSet = GetObject("winmgmts:").InstancesOf ("win32_OperatingSystem")


for each SN in SNSet
MsgBox "The serial number for the installed OS is: " & SN.SerialNumber
Next

Get Operating System installed on a machine


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
    Wscript.Echo objOperatingSystem.Caption & " " & _
        objOperatingSystem.Version
Next

Get ComputerName and Username - VBScript


Set oNetwork = CreateObject("WScript.Network")
sUserName = oNetwork.UserName
sComputerName = oNetwork.ComputerName
MsgBox("UserName = " & sUserName & vbCRLF & "ComputerName = " & sComputername)

Get IP Address of machine - VBScript


On Error Resume Next
Dim IPADDRES 
Dim WshShell 


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
 & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colNicConfigs = objWMIService.ExecQuery _
 ("SELECT * FROM Win32_NetworkAdapterConfiguration WHERE IPEnabled = True")


Set WshShell=CreateObject("WScript.Shell")


For Each objNicConfig In colNicConfigs
      For Each strIPAddress In objNicConfig.IPAddress
             IPADDRES = strIPAddress
      Next
Next


msgbox IPADDRES


Set WshShell = Nothing
WScript.Quit

Create Text file and write lines using VBScript


Following script will create sample.txt file in the location where this script is stored and 10.10..10.93 will be written to sample.txt file




Dim objWshShell, objFSO, sScriptDir
Set objWshShell = CreateObject("WScript.Shell")
Set objFSO = CreateObject("Scripting.FileSystemObject")


sScriptDir=objFSO.GetParentFolderName(WScript.ScriptFullName)
strSecFileName = sScriptDir & "\sample.txt"


Set objSecFile = objFSO.CreateTextFile(strSecFileName, True)
objSecFile.WriteLine("10.10.10.93")


Set objFSO = Nothing
Set objWshShell = Nothing