Sunday 26 October 2014

Secure your browser from being hacked

These days user interest is everything and this is something Google got to know a while back and started monitoring user search queries and shows the ads to user wherever he visits accordingly. Some of the other also tried to get in such practices and launched their search engine however since they have started something with low cost and needed huge profit thus do the malpractice when you install them.



Today we are discussing about an add on and search engine Mystartsearch.com which gets installed along with other untrustworthy applications and steals our web history and route us to wrong websites at times and crashes our browsers. This tool also creates unnecessary slowness while surfing. I have removed this from so many users of my organization. In order to remove this malicious application from your computer. Follow the steps.


Solutions

There are many ways of removing it but which best worked out for me is to remove its folder from Program Files.

You wouldn't find one with the same name however unknown software will keep its setup inherent therefore delete the one you think is less important.

It will not let you delete the folder right away but will give you folder is in use error in that case stop its process from task manager.


Regards, Baij

Saturday 25 October 2014

Save computer inventory in text file - Save your precious time !!

In the early days of my joining in IT infrastructure team I encountered a handful of instances where I had to note down serial number, Model number, Operating system, Physical Memory, HDD manually and many other things which used to be so time consuming.

As a result I created one script so that I could have all that information in one text file and I could save it on my system and share with everybody. Here below is one of my script.

****Start

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _

    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
   Set colBIOS = objWMIService.ExecQuery _
    ("Select * from Win32_BIOS")
Set wshNetwork = WScript.CreateObject( "WScript.Network" )
ff=wshNetwork.ComputerName
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objItem in colItems
Model = objItem.Model
RAM = Int(objItem.TotalPhysicalMemory /(100000000))
timenow = Now
Next
Set oss = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
For Each os in oss
OSystem = os.Caption
Next
For each objBIOS in colBIOS
    Manufacturer = objBIOS.Manufacturer
    Serial= objBIOS.SerialNumber
Next
Set colChassis = objWMIService.ExecQuery _

("Select * from Win32_SystemEnclosure",,16)
For Each objChassis in colChassis
  For Each objItem in objChassis.ChassisTypes
    Select Case objItem
    Case 1 strChassis = "Maybe Virtual Machine"
    Case 2 strChassis = "??"
    Case 3 strChassis = "Desktop"
    Case 4 strChassis = "Thin Desktop"
    Case 5 strChassis = "Pizza Box"
    Case 6 strChassis = "Mini Tower"
    Case 7 strChassis = "Full Tower"
    Case 8 strChassis = "Portable"
    Case 9 strChassis = "Laptop"
    Case 10 strChassis = "Notebook"
    Case 11 strChassis = "Hand Held"
    Case 12 strChassis = "Docking Station"
    Case 13 strChassis = "All in One"
    Case 14 strChassis = "Sub Notebook"
    Case 15 strChassis = "Space-Saving"
    Case 16 strChassis = "Lunch Box"
    Case 17 strChassis = "Main System Chassis"
    Case 18 strChassis = "Lunch Box"
    Case 19 strChassis = "SubChassis"
    Case 20 strChassis = "Bus Expansion Chassis"
    Case 21 strChassis = "Peripheral Chassis"
    Case 22 strChassis = "Storage Chassis"
    Case 23 strChassis = "Rack Mount Unit"
    Case 24 strChassis = "Sealed-Case PC"
    End Select
  Next
Next
Set NIC1 = GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")

For Each Nic in NIC1

if Nic.IPEnabled then

StrIP = Nic.IPAddress(i)
MAC = Nic.MACAddress
end If
Next

Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem in colItems
    CPU = objItem.Name
Next
Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like 'Microsoft Office%'")

    If colSoft.Count = 0 Then
MS = "NO OFFFICE INSTALLED"
    else
       For Each objItem In colSoft
          MS = objitem.caption
          exit for
       Next
    End If
Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like 'Sony Sound%'")

    If colSoft.Count = 0 Then
Sony = "NOSonySoundForge"
    else
       For Each objItem In colSoft
          Sony = objitem.caption
          exit for
       Next
    End If
'Visio

Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like 'Microsoft Office Visio%'")

    If colSoft.Count = 0 Then
Visio = "NOVisio"
    else
       For Each objItem In colSoft
          Visio = objitem.caption
          exit for
       Next
    End If
'OneNote

Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like 'Microsoft Office OneNote%'")

    If colSoft.Count = 0 Then
OneNote = "NOOneNote"
    else
       For Each objItem In colSoft
          OneNote = objitem.caption
          exit for
       Next
    End If

'Project

Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like 'Microsoft Office Project%'")

    If colSoft.Count = 0 Then
Project = "NOProject"
    else
       For Each objItem In colSoft
          Project = objitem.caption
          exit for
       Next
    End If
'Visual Studio

Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like 'Microsoft Visual Studio%'")

    If colSoft.Count = 0 Then
VS = "NOVS"
    else
       For Each objItem In colSoft
          VS = objitem.caption
          exit for
       Next
    End If
'FrontPage

Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like 'Microsoft Office FrontPage%'")

    If colSoft.Count = 0 Then
FrontPage = "NOFrontPage"
    else
       For Each objItem In colSoft
          FrontPage = objitem.caption
          exit for
       Next
    End If

'Photoshop

Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like 'Adobe Photoshop%'")

    If colSoft.Count = 0 Then
Photoshop = "NOPhotoshop"
    else
       For Each objItem In colSoft
          Photoshop = objitem.caption
          exit for
       Next
    End If

'CC

Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like 'Adobe Creative Cloud%'")

    If colSoft.Count = 0 Then
CC = "NOCC"
    else
       For Each objItem In colSoft
          CC = objitem.caption
          exit for
       Next
    End If

'Illustrator

Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like '%Illustrator%'")

    If colSoft.Count = 0 Then
Illustrator = "NOIllustrator"
    else
       For Each objItem In colSoft
          Illustrator = objitem.caption
          exit for
       Next
    End If

'Flash

Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like '%DreamWeaver%'")

    If colSoft.Count = 0 Then
Flash = "NOFlash"
    else
       For Each objItem In colSoft
          Flash = objitem.caption
          exit for
       Next
    End If

'Aftereffects

Set colSoft = objWMIService.ExecQuery("SELECT * FROM Win32_Product WHERE Name Like '%Aftereffects%'")

    If colSoft.Count = 0 Then
Aftereffects = "NOAftereffects"
    else
       For Each objItem In colSoft
          Aftereffects = objitem.caption
          exit for
       Next
    End If
Set colItems = objWMIService.ExecQuery(_
"Select * from Win32_DiskDrive")
For Each objItem in colItems
HDD = Int(objItem.Size /(1000000000))
Next
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.FolderExists("C:\Inv") Then
Set newfolder = fso.CreateFolder("C:\Inv")
End If
Set oFile = fso.OpenTextFile("C:\inv\" & ff &".txt",2,True)

oFile.Writeline wshNetwork.UserName &Space(1)& strChassis &Space(1)& Replace(Manufacturer," ","") &Space(1)& _
Replace(Model," ","") &Space(1)& Serial &Space(1)& wshNetwork.ComputerName _
&Space(1)&"N/A "&Replace(CPU," ","") &Space(1)& RAM &Space(1)& HDD &Space(1)& StrIP &Space(1)&MAC &Space(1)& _
Replace(OSystem," ","") &Space(1)& Replace(MS," ","") &Space(1)& Replace(Sony," ","")&Space(1)& Replace(Visio," ","") _
&Space(1)& Replace(OneNote," ","")&Space(1)& Replace(Project," ","")&Space(1)& Replace(VS," ","")&Space(1)& Replace(FrontPage," ","") _
&Space(1)& Replace(Photoshop," ","")&Space(1)& Replace(CC," ","")&Space(1)& Replace(Illustrator," ","") _
&Space(1)& Replace(Flash," ","")&Space(1)& Replace(DreamWeaver," ","") _
&Space(1)& Replace(Aftereffects," ","")&Space(1)& Replace((Now)," ","")
oFile.Close

sDestServer = "PCNOD513062"
Const OverwriteExisting = True

Sharepath = "\\" &sDestServer& "\Files\"
CopyFromPath = "C:\inv\" & ff &".txt"
FSO.CopyFile CopyFromPath,Sharepath,OverwriteExisting


***End
Regards, Baij

Computer Inventory - straight on email WOW !!

It was not enough to create the inventory till it fetched the details on email IDs thus created one which could send the details to any requester email ID. This script is necessary in case shared path at which we wanted to save the inventory is not accessible or we have to send it straight to someone on his email only.


Start from right below -

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
   Set colBIOS = objWMIService.ExecQuery _
    ("Select * from Win32_BIOS")
Set wshNetwork = WScript.CreateObject( "WScript.Network" )
ff=wshNetwork.ComputerName
Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")
For Each objItem in colItems

Model = objItem.Model
RAM = Int(objItem.TotalPhysicalMemory /(100000000))
timenow = Now
Next
Set oss = objWMIService.ExecQuery ("Select * from Win32_OperatingSystem")
For Each os in oss
OSystem = os.Caption
Next
For each objBIOS in colBIOS
    Manufacturer = objBIOS.Manufacturer
    Serial= objBIOS.SerialNumber
Next
Set colChassis = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure",,16)
For Each objChassis in colChassis
  For Each objItem in objChassis.ChassisTypes
    Select Case objItem
    Case 1 strChassis = "Maybe Virtual Machine"
    Case 2 strChassis = "??"
    Case 3 strChassis = "Desktop"
    Case 4 strChassis = "Thin Desktop"
    Case 5 strChassis = "Pizza Box"
    Case 6 strChassis = "Mini Tower"
    Case 7 strChassis = "Full Tower"
    Case 8 strChassis = "Portable"
    Case 9 strChassis = "Laptop"
    Case 10 strChassis = "Notebook"
    Case 11 strChassis = "Hand Held"
    Case 12 strChassis = "Docking Station"
    Case 13 strChassis = "All in One"
    Case 14 strChassis = "Sub Notebook"
    Case 15 strChassis = "Space-Saving"
    Case 16 strChassis = "Lunch Box"
    Case 17 strChassis = "Main System Chassis"
    Case 18 strChassis = "Lunch Box"
    Case 19 strChassis = "SubChassis"
    Case 20 strChassis = "Bus Expansion Chassis"
    Case 21 strChassis = "Peripheral Chassis"
    Case 22 strChassis = "Storage Chassis"
    Case 23 strChassis = "Rack Mount Unit"
    Case 24 strChassis = "Sealed-Case PC"
    End Select
  Next
Next
Set NIC1 = GetObject("winmgmts:").InstancesOf("Win32_NetworkAdapterConfiguration")

For Each Nic in NIC1

if Nic.IPEnabled then

StrIP = Nic.IPAddress(i)
MAC = Nic.MACAddress
end If
Next

Set colItems = objWMIService.ExecQuery("Select * from Win32_Processor")
For Each objItem in colItems
    CPU = objItem.Name
Next
on error resume next

Const schema   = "http://schemas.microsoft.com/cdo/configuration/"
Const cdoBasic = 1
Const cdoSendUsingPort = 2
Dim oMsg, oConf, strReport

strReport = strReport & "<body>"
strReport = strReport & "<div align='center'>"
strReport = strReport &  "<br>"
strReport = strReport & "<table border='1' style='border-collapse: collapse'>"
   strReport = strReport & "<tr bgcolor='#fff' bordercolor='#222' size='2'>"
      strReport = strReport & "<td colspan='2' align='center'><Font size = '2'>" & wshNetwork.UserName & "</Font size></td>"
 strReport = strReport & "<td colspan='2' align='center'><Font size = '2'>" & strChassis & "</Font size></td>"
      strReport = strReport & "<td colspan='2' align='center'><Font size = '2'>" & Manufacturer & "</Font size></td>"
 strReport = strReport & "<td colspan='2' align='center'><Font size = '2'>" & Model & "</Font size></td>"
 strReport = strReport & "<td width='80' colspan='2' align='center'><Font size = '2'>" & Serial & "</Font size></td>"
 strReport = strReport & "<td width='80' colspan='2' align='center'><Font size = '2'>" & wshNetwork.ComputerName & "</Font size></td>"
 strReport = strReport & "<td width='80' colspan='2' align='center'><Font size = '2'>" & CPU & "</Font size></td>"
 strReport = strReport & "<td width='80' colspan='2' align='center'><Font size = '2'>" & RAM & "</Font size></td>"
 strReport = strReport & "<td width='80' colspan='2' align='center'><Font size = '2'>" & HDD & "</Font size></td>"
 strReport = strReport & "<td width='80' colspan='2' align='center'><Font size = '2'>" & StrIP & "</Font size></td>"
 strReport = strReport & "<td width='80' colspan='2' align='center'><Font size = '2'>" & MAC & "</Font size></td>"
 strReport = strReport & "<td width='80' colspan='2' align='center'><Font size = '2'>" & OSystem & "</Font size></td>"
 strReport = strReport & "<td width='20' align= 'right'>" & FormatDateTime(Date(),1) & "</td>"
   strReport = strReport & "</tr>"
strReport = strReport & "</table>"

' E-mail properties
Set oMsg      = CreateObject("CDO.Message")
oMsg.From     = "baij.rathore@one97.net"  ' or "Sender Name <baij.rathore@one97.net>"
oMsg.To       = "baij.rathore@one97.net"    ' or "Recipient Name <baij.rathore@one97.net>"
oMsg.Subject  = "Test from VBScript"
oMSG.HTMLBody = strReport



' GMail SMTP server configuration and authentication info
Set oConf = oMsg.Configuration
oConf.Fields(schema & "smtpserver")       = "smtp.gmail.com" 'server address
oConf.Fields(schema & "smtpserverport")   = 465              'port number
oConf.Fields(schema & "sendusing")        = cdoSendUsingPort
oConf.Fields(schema & "smtpauthenticate") = cdoBasic         'authentication type
oConf.Fields(schema & "smtpusessl")       = True             'use SSL encryption
oConf.Fields(schema & "sendusername")     = "brathoreit@gmail.com" 'sender username
oConf.Fields(schema & "sendpassword")     = "*********"      'sender password
oConf.Fields.Update()

' send message
oMsg.Send()

' Return status message
If Err Then
    resultMessage = "ERROR " & Err.Number & ": " & Err.Description
    Err.Clear()
Else
    resultMessage = "Message sent ok"
End If
Set wshNetwork.UserName = Nothing
Set strChassis = Nothing
Set Manufacturer = Nothing
Set Model = Nothing
Set Serial = Nothing
Set wshNetwork.ComputerName = Nothing
Set CPU = Nothing

Wscript.echo(resultMessage)


Ending till above line.

Regards, Baij

Install Multiple Software with a Click