December 2008 - Posts

VBS Script To Send Basic Machine Information To Excel

 

This VBS Script will send the following information for a specified machine name to excel: Machine Name, User Name, Operating System, Build Version, Manufacturer and Model.

 

VBS Script:

 

strComputer = InputBox ("Enter Machine Name")

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

 

objExcel.Cells(1, 1).Value = "Machine Name"

objExcel.Cells(2, 1).Value = "User Name"

objExcel.Cells(3, 1).Value = "Operating System"

objExcel.Cells(4, 1).Value = "Build Version"

objExcel.Cells(5, 1).Value = "Manufacturer"

objExcel.Cells(6, 1).Value = "Model"

 

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")

For Each objItem in colItems

objExcel.Cells(1, 2).Value = objItem.CSName

objExcel.Cells(3, 2).Value = objItem.Manufacturer

objExcel.Cells(4, 2).Value = objItem.Version & Space(1) & objItem.CSDVersion & " Build " &  objItem.BuildNumber

objExcel.Cells(3, 2).Value = objItem.Caption

Next

 

Set colItems = objWMIService.ExecQuery("Select * from Win32_ComputerSystem")

For Each objItem in colItems

objExcel.Cells(2, 2).Value = objItem.UserName

objExcel.Cells(5, 2).Value = objItem.Manufacturer

objExcel.Cells(6, 2).Value = objItem.Model

Next

 

objExcel.Range("A1:A6").Select

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

 

MsgBox "Done"

 

 

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Retrieve Machines And Their MAC Addresses From A Specified Site Server

 

This VBS script will retrieve machine names and their corresponding Media Access Control (MAC) addresses and send the results to an excel spreadsheet.

 

VBS Script:

 

strServer = InputBox ("Enter Site Server Name")

strDatabase = InputBox ("Enter Three Letter Site Code")

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

objExcel.Cells(1, 1).Value = "Machine Name"

objExcel.Cells(1, 2).Value = "MAC Address"

 

Const adOpenStatic = 3

Const adLockOptimistic = 3

 

Set objConnection = CreateObject("ADODB.Connection")

objConnection.Open "Provider=SQLOLEDB;Data Source =" & strServer & ";" & _

"Trusted_Connection=Yes;Initial Catalog =SMS_" & strDatabase

 

Set objRecordSet = CreateObject("ADODB.Recordset")

objRecordSet.Open _

" Select SD.Name0,MAC.MAC_Addresses0" & _ 

" From v_R_System SD" & _

" Join v_RA_System_MacAddresses MAC On SD.ResourceID = MAC.ResourceID" _

, objConnection, adOpenStatic, adLockOptimistic

 

objRecordSet.MoveFirst

Do Until objRecordSet.EOF

 

objExcel.Cells(intRow, 1).Value = objRecordSet.Fields("Name0").Value

objExcel.Cells(intRow, 2).Value = objRecordSet.Fields("MAC_Addresses0").Value

objRecordSet.MoveNext

intRow = intRow + 1

Loop

 

objExcel.Range("A1:B1").Select

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

 

Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

Set objRange = objExcel.Range("A1")

objRange.Sort objRange,1,,,,,,1

 

MsgBox "Done"

 

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Retrieve Laptop Battery Information For A List Of Machines

 

This VBS script will read a text file called MachineList.Txt and will write battery information for each of the resources to an Excel spreadsheet.

 

VBS Script:

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

objExcel.Cells(1, 1).Value = "System Name"

objExcel.Cells(1, 2).Value = "Device ID"

objExcel.Cells(1, 3).Value = "Name"

 

Set Fso = CreateObject("Scripting.FileSystemObject")

Set InputFile = fso.OpenTextFile("MachineList.Txt")

Do While Not (InputFile.atEndOfStream)

strComputer = InputFile.ReadLine

 

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_Battery")

For Each objItem in colItems

objExcel.Cells(intRow, 1).Value = objItem.SystemName

objExcel.Cells(intRow, 2).Value = objItem.DeviceID

objExcel.Cells(intRow, 3).Value = objItem.Name

intRow = intRow + 1

Next

Loop

 

objExcel.Range("A1:C1").Select

objExcel.Selection.Interior.ColorIndex = 19

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

 

Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

Set objRange = objExcel.Range("A1")

objRange.Sort objRange,1,,,,,,1

 

MsgBox "Done"

 

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Retrieve BIOS Information For A List Of Machines

 

This VBS script will read a text file called MachineList.Txt and will write BIOS information for each of the machines to an Excel spreadsheet.

 

VBS Script:

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

objExcel.Cells(1, 1).Value = "System Name"

objExcel.Cells(1, 2).Value = "Manufacturer"

objExcel.Cells(1, 3).Value = "Serial Number"

objExcel.Cells(1, 4).Value = "Version"

 

Set Fso = CreateObject("Scripting.FileSystemObject")

Set InputFile = fso.OpenTextFile("MachineList.Txt")

Do While Not (InputFile.atEndOfStream)

strComputer = InputFile.ReadLine

 

Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS")

For Each objItem in colItems

objExcel.Cells(intRow, 1).Value = UCase(strComputer)

objExcel.Cells(intRow, 2).Value = objItem.Manufacturer

objExcel.Cells(intRow, 3).Value = objItem.SerialNumber

objExcel.Cells(intRow, 4).Value = objItem.SMBIOSBIOSVersion

intRow = intRow + 1

Next

Loop

 

objExcel.Range("A1:D1").Select

objExcel.Selection.Interior.ColorIndex = 19

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

 

Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

Set objRange = objExcel.Range("A1")

objRange.Sort objRange,1,,,,,,1

 

MsgBox "Done"

 

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Delete Files Older Than Eight Hours

 

This VBS Script will delete files in a specified directory folder that are older than 8 hours.

 

VBS Script:

 

strFolder = "C:\Folder Name"

 

Set Fso = CreateObject("Scripting.FileSystemObject")

Set Directory = Fso.GetFolder(strFolder)

Set Files = Directory.Files

 

For Each Modified in Files

If DateDiff("H", Modified.DateLastModified, Now) > 8 Then Modified.Delete

Next

 

MsgBox "Done"

 

 

Posted by dhite | with no comments
Filed under:

SQL Query To Count Installed Resources By Site

 

This SQL query will display the count for resources installed on a site.

 

SQL Query:

 

Select Count(SS.ResourceID) Resources,

Sc.SiteCode 'Site Code'

 

From v_RA_System_SMSInstalledSites SS

Join v_Site SC On SS.SMS_Installed_Sites0 = SC.SiteCode

 

Group by Sc.SiteCode

Order By Resources

 

 

 

Posted by dhite | with no comments
Filed under:

SQL Query To Find Machine Resources With No SMS Unique Identifiers Or GUIDS

 

This SQL Query will list all of the machine resources that do not have an SMS Unique Identifier or GUID.

 

SQL Query:

 

Select

SD.Name0 'Machine Name'

 

From System_Disc SD

 

Join MachineIdGroupXRef ID

On SD.ItemKey = ID.MachineID

And IsNull (SD.Sms_Unique_Identifier0, '')

<> ISNULL(ID.Guid, '')

 

 

Posted by dhite | with no comments
Filed under:

BigWig

 

The terms Bigwig, Big Wig or Big Wigs has its origins in 17th century France but was not popularized until it reached England in the 18th century. English nobles and others of importance such as priest, judges and lawyers wore wigs as did other professionals. The rich had more to spend on their wigs than those less fortunate. As a result their wigs contained more material and were taller or bigger hence the term Big Wig(s) came to be used to describe people of importance, wealth or those in charge.

 

 

Posted by dhite | with no comments
Filed under:

Royal TS Freeware Terminal Services manager

 

Royal TS freeware is an alternative for the standard Terminal Services Snap-In that adds additional features, including connection specific display settings, stored login credentials and more. It allows you to connect to any server which supports RDP protocol, and the connections can be organized in custom categories for quick access. Additional features include console connections (Windows XP/2003 or later), custom RDP target port, display smart sizing, port redirection and more.

 

Overview:

http://www.code4ward.net/main/RoyalTS/Overview.aspx

 

Screen Shots:

http://www.code4ward.net/main/RoyalTS/Screenshots.aspx

 

Download:

http://www.code4ward.net/main/RoyalTS/Download.aspx

 

 

 

Posted by dhite | with no comments
Filed under: ,

SQL Query Logical Operators

 

Provided here is a table containing the SQL logical operations with a brief description of each.

 

Operator

Description

=

Equal to

!= or <>

Not equal to

Greater than

>=

Greater than or equal to

Less than

<=

Less than or equal to

In

Equal to any item in a list

Not in

Not equal to any item in a list

Between

Between two values

Not between

Not between two values

Begins with

Begins with specified value

Contains

Contains specified value

Not contains

Does not contain specified value

Is null

Is blank

Is not null

Is not blank

Like

Like a specified pattern.

Not like

Not like a specified pattern.

.

 

Posted by dhite | with no comments

Desired Configuration Monitoring Log File Table

 

The table below will briefly describe the Desired Configuration Monitoring (DCM) log files and their purposes.

 

 

Log File

Description

DcmAgent

Provides information about assigned configuration baselines evaluations and desired configuration management processes.

CiAgent

Provides information about downloading, storing, and accessing assigned configuration baselines.

SdmAgent

Provides information about downloading, storing, and accessing configuration item content.

SdmDiscAgent

Provides high-level information about the evaluation process for objects and settings configured in the referenced configuration items.

Discovery

Provides detailed information about the Service Modeling Language (SML) processes.

 

 

Posted by dhite | with no comments
Filed under:

By Request VBS Script Query User Terminal Server

 

This By Request VBS script is provided as an example of how to query the user(s) logged onto a remote terminal server.

 

VBS Script:

 

strComputer = InputBox("Enter Terminal Server Name")

 

Set objShell = CreateObject("WScript.Shell")

Set objFSO = CreateObject("Scripting.FileSystemObject")

 

strCommand = "Query User /Server:" & strComputer

objShell.Run("%Comspec% /K ") & strCommand,1,True

 

 

 

Posted by dhite | with no comments
Filed under:

Husbands Vs Horses

 

Good Things About Husbands:

 

  • A husband with a belly-ache doesn't have to be walked.
  • A lame husband can still work.
  • Feeding a husband doesn't require anything that even mildly compares with the hassle of putting up hay.
  • For a nominal fee you can hire someone else to clip them.
  • Husbands are less expensive to shoe.
  • Husbands don't try to scratch their heads on your back.
  • If they're playing hard to catch you “may” be able to run them down on foot.
  • They apologize when they step on your toes.
  • They don't panic, yelling and running all through the house when you leave them alone. (unless you left the kids too)
  • They know their name.
  • They pay their own bills.
  • They seldom refuse to get in the vehicle.
  • They're better able to understand puns.  

Good Things About Horses:

 

  • If they don't work out you can sell them.
  • If you get too fat for one you can shop for a bigger one.
  • It's possible to keep them from "jumping the fence".
  • They don't care what you look like, as long as you have a carrot.
  • They don't come with in-laws.
  • They don't want their turn at the computer.
  • They learn to accept restraint.
  • They smell good when they sweat.
  • They turn white with age, but not bald.
  • You can force them to stay in good physical condition...with a whip if necessary.
  • You can repair their "clothes" with duct tape.
  • You don't have to worry about your children looking like them.
  • You never have to iron their saddle pads.

 

 

Posted by dhite | with no comments
Filed under:

Artsy Grab Bag Of Links

 

Paint Like Jackson Pollock

http://www.jacksonpollock.org

 

Monte Python's Silly Walks Generator

http://www.sillywalksgenerator.com

 

 

Posted by dhite | with no comments
Filed under:

Things Not To Say To Your Farrier

 

  • Are you sure you have them on the correct foot?
  • Boy, you must have a strong back to bend over all day like that.
  • Can we shoe him in the arena? If he rears in the barn, he hits his head.
  • Can you come back? We are home now.
  • Can you put these shoes on good and tight so that they won’t come off?
  • Does it mean my horses have some sort of deficiency when they chew the paint off your truck like that?
  • Good morning glad you’re here can we reschedule? I have a lot going on today.
  • He kicked the last farrier just like he kicked you.
  • He never does that for me.
  • He won’t stand for me either, but your ad said you were a professional
  • He’s never been that bad!! What did you do?
  • I forgot you were coming; I just turned all the horses out wait just a minute.
  • I got a bargain on these shoes at a rummage sale, could you use them instead and save me some money?
  • I just cannot believe that he bit you.
  • I know I said just a trim, but can we shoe ‘em as well?
  • I know it’s been a long day for you; that’s why I saved the worst one for last.
  • I know that he is difficult to shoe, but he is so good on the trails.
  • I see who makes all the money in horses. Farriers!
  • I’m sure glad you don’t mind working on muddy feet.
  • If he didn’t kick like that, I’d trim him myself.
  • If you will just give each of the dogs a piece of hoof they will get out from under the horse and quit fighting.
  • It doesn’t look like he’s leaning from here.
  • It sure is Hot I will be back in a bit.
  • It’s a good thing you’re slow today, or he’d have had shoes on when he kicked your truck.
  • Let me get my twitch before we get started.
  • Most times when he kicks, he misses!
  • My horse hates men.
  • My last farrier couldn’t finish so they gave me your name and number.
  • My weanling colt needs a trim, and I figured you could halter break him at the same time.
  • Since he’s a colt, will you charge me half price?
  • These shoes have been on for only 12 weeks, and they are getting loose.
  • You don’t mind if I feed the other horses, do you?
  • You sure earned your money on that one!

 

 

Posted by dhite | with no comments
Filed under:
More Posts Next page »