Wednesday, December 30, 2009

List all installed software

This code is useful in documenting what is installed on a computer including Microsoft patches.  The original version I wrote formatted the output for a Wiki. The output is created in the same directory as the script, example: [mycomputer]-inventory.txt

Code – *.vbs

Option Explicit
Const HKLM = &H80000002 ' HKEY_LOCAL_MACHINE
Const APPEND = 8 ' Append to file
dim objShell
dim objFso
dim objReg
Set objShell = CreateObject("WScript.Shell")
Set objFso = CreateObject("Scripting.FileSystemObject")
Set objReg = GetObject("WinMgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")

dim strRegIdentityCodes
dim strRegComputerName ' registry path to machine name
dim strComputerName ' computer name
strRegIdentityCodes = "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall"
strRegComputerName = "HKLM\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName"
strComputerName = objShell.RegRead(strRegComputerName)

' Create file delete if it already exists
dim strFileOut
strFileOut = strComputerName & "-Inventory.txt"
If objFso.FileExists(strFileOut) Then
objFso.DeleteFile strFileOut, true
End If
dim objFileOut
Set objFileOut = objFSO.CreateTextFile(strFileOut)

dim arrIdentityCode
objReg.EnumKey HKLM, strRegIdentityCodes, arrIdentityCode
objFileOut.WriteLine("Computer Name: " & strComputerName)
objFileOut.WriteLine("Inventory of installed products taken on: " & Now)
objFileOut.WriteLine("")

On Error Resume Next
dim strIdentityCode
dim strRegIdentityInfo
dim strDisplayName
dim strDisplayVersion
For Each strIdentityCode in arrIdentityCode
strRegIdentityInfo = "HKLM\" & strRegIdentityCodes & "\" & strIdentityCode & "\"
strDisplayName = objShell.RegRead(strRegIdentityInfo & "DisplayName")
strDisplayVersion = objShell.RegRead(strRegIdentityInfo & "DisplayVersion")
if(strDisplayName <> "")then
objFileOut.WriteLine(strDisplayName)
objFileOut.WriteLine(chr(9) & strIdentityCode & ", " & strDisplayVersion )
end if
strDisplayName = ""
strDisplayVersion =""
Next

objFileOut.Close
objShell.Run "cmd /c C:\WINDOWS\pchealth\helpctr\binaries\helpctr.exe -mode hcp://system/sysinfo/msinfo.xml", 1, true



Create Local Win NT User, Windows User

Two quick and easy methods of creating local NT users.  The samples (DOS and VBS) below create a user on the local system, the VBS method check to see if the user exists before adding.

DOS:
NET USER DosUser UserPassword /add

VBS:

Set WshNetwork = CreateObject("WScript.Network")
strComputerName = WshNetwork.ComputerName 'getting the machine name
strUserName="VbsUser"
strPassword="UserPassword"
checkuser = 1 
Set objComputer = GetObject("WinNT://" & strComputerName)
objComputer.Filter = Array("User")
For Each objUser In objComputer
    If (objUser.Name = strUserName) And (checkuser = 1) Then 
       checkuser = 0
   End If
Next

If checkuser = 1 Then
   Set colaccounts = GetObject("WinNT://" & strComputerName & ",computer")
   Set objUser = colaccounts.Create("user", strUserName)
   objUser.SetPassword strPassword
   objUser.SetInfo
End If

Thursday, November 5, 2009

Richard Casady has invited you to Dropbox

We're excited to let you know that Richard Casady has invited you to Dropbox!

Richard Casady has been using Dropbox to sync and share files online and across computers, and thought you might want it too.

Visit www.getdropbox.com to get started.

- The Dropbox Team

Thursday, October 15, 2009

Automate Internet Explorer from VB Script

Control Internet Explorer from VB Script using the Internet Explorer COM object.  The code below shows how to do the following:

  • Open Internet Explorer
  • Navigate to different URL’s
  • Make Internet Explorer visible/invisible
  • Populate a textbox on a web page
  • Click a button on a web page

You can use scripts like this to automate anything you do repeatedly to save time, such as: Web logins, screen captures, fake traffic or vote in internet polls.  I used a script similar to this one to enter my self in a drawing for a new house, I set the script up on the windows scheduler to run once a day since the contest specified that you were allowed to enter once daily. I didn't win!

Code – *.vbs

Dim oIE	
IeNew("www.google.com")

' Put your name into the "Search" textbox
' Notice below that the textbox's name is "q"
oIE.document.all.q.value = "Rick Casady"

WScript.Sleep(100)

' Click the Search button
' Notice below that the button's name is "q"
oIE.document.all.btnG.click()


' Create a Internet Explorer COM object and then Navigate the Navigate sub
' Also sets the Internet explorer to be visible
Public Sub IeNew(ByVal strURL)
Set oIE = CreateObject("InternetExplorer.Application")
Navigate(strURL)
oIE.Visible = True
End Sub

' Navigates to the URL provided then waits for IE to complete.
Public Sub Navigate(ByVal strURL)
oIE.Navigate(strURL)
Do
WScript.Sleep(200)
Loop Until Not oIE.Busy
End Sub

Monday, October 12, 2009

Review of the Acer Aspire One

    So, I decided to purchase the Acer Aspire One with the Intel Atom CPU N270 @ 1.60 GHz. I think I'm happy with the choice so far, time will tell. Below is a picture of of the "Aspire One" next to my 19" monitor, keyboard and mouse.

    Overall the "Aspire One" is a strong buy and I recommend it for the price.
    It's a good deal at around $299 and up depending on where you buy, and when you get the Costco bundle at $349 its even better.... The Costco bundle includes the 6 cell battery, wireless optical mouse, carrying case and external DVD-R drive.
    Some say it's a little big for its class and heavy especially with the 6 cell battery, but that's not true if weight over 90 pounds... Actually if it was any smaller I couldn't use it! The highest resolution is 1024 x 600 and some programs actually check the resolution and fail if it is set that low.... Additionally it's a little hard to set it on your lap and keep stable and while using the very small keyboard.... Skip to the end Rick! It is small but not too small...


    Stats
    Intel Atom CPU N270 @ 1.60 GHz
    • 1 GB RAM
    • 160 GB hard drive
    • WebCam built in
    • 10.1" LED LCD

    My New Netbook purchase of a "Aspire One" was long coming. I hadn't bought a "NEW" computer since around 2003 when I purchased a AMD Athlon 750 MHz motherboard with a 200 MHz FBS. That seems like a lot longer now that I've said it, but the truth is a Athlon 750 will do almost anything you need a computer to do.

    My Needs
    So I wanted to get a machine that's portable so I can use it on the couch or while on the run. But I also want a machine powerful enough to edit video and play games. My first and only thoughts for the past 3 years had been buy the most powerful laptop I can find and dock it to my monitor, keyboard, mouse, external DVD burner, stereo....Skip to the end Rick! What a pain I would need to get a business laptop that is also sold with a docking station or suffer the process of getting a USB hub and plug/unplug way to many cords multiple times a day. Additionally I would end up paying a lot of money for a laptop that might not fulfill all my requirements for a good desktop, so then why bother... I decided to get two computers; one a supper portable computer and the other a work horse. The portable computer would of course be the "Aspire One"

    Background
    One day I found this thing called an Eee PC it was great, the price was cheep, and it was very small/light. This "Netbook" was perfect it solved half my needs at %20 of my budget, there was no reason not to buy it immediately. So I did what any person would do before making such a purchase, I told a group of people at work about the Eee PC and all of its wonder (not mentioning that I was in fact about to buy one). I have never heard grown men so upset at a product, if you listened to them you would have thought "Hitler" him self had built each one. In hind sight the two people most confused at the concept of a small laptop where the two mangers most responsible for the "product" my team built. That "product" confused our customers so much our department was closed and most everyone laid off.... Skip to the end Rick! So I backed down and decided not to buy this new unproven ultra small laptop. Now these laptops are extremely cool everyone wants one, or hates them it seems. That's the definition of "cool" everyone like or hates a person place or thing.

    Next steps
      Install Windows 7 and find the hope only President Obama him self can give.

    Thursday, September 24, 2009

    I decided to sign up for a blogger account today

    I finally made the plunge into the blogging world, we'll see how long this lasts. The main reason I'm starting this blog is to help my failing memory, I cant seem to remember what the name of my favorite duplicate file finder program is.

    I guess if I had blogged about how cool it was I could go back to that blog and find happiness again. Also if anyone finds this blog they could tell me there favorite dup finder.... Honestly that wont happen but I can hope.