August 2008 - Posts

VBS Script To Retrieve SMS Executive Service Information From A List Of Machines

 

This VBS script will read a text file called MachineList.Txt and will write the SMS Executive services information for the site servers to an excel spreadsheet. If the service state is stopped the results will be written in red.

 

VBS Script:

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

Set Fso = CreateObject("Scripting.FileSystemObject")

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

Do While Not (InputFile.atEndOfStream)

strComputer = InputFile.ReadLine

 

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

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

objExcel.Cells(1, 3).Value = "Current State"

 

servicename = "SMS_Executive"

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

Set colItems = objWMIService.ExecQuery("Select * From Win32_Service Where Name = '" & servicename & "'")

 

For Each objItem in colItems

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

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

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

If objExcel.Cells(intRow, 3).Value = "Stopped" Then

objExcel.Cells(intRow, 3).Font.ColorIndex = 3

End If

 

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

 

MsgBox "Done"

 

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Browse For Folder And Send Sub Folders Name And Size To Excel

 

This VBS Script will allow to browse for a directory folder and will write the subfolders name and size to an excel spreadsheet.

 

VBS Script:

 

strComputer = "."

 

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

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.BrowseForFolder (0, "Select Folder:", (0))

If objFolder Is Nothing Then

Wscript.Quit

Else

Set objFolderItem = objFolder.Self

objPath = objFolderItem.Path

End If

 

Set objFolderItem = objWMIService.ExecQuery _

("Associators of {Win32_Directory.Name='" & strFolderName & "'} " _

& "Where AssocClass = Win32_Subdirectory " _

& "ResultRole = PartComponent")

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

objExcel.Cells(1, 1).Value = "Folder"

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

 

Set objShell = CreateObject ("Shell.Application")

For Each strFileName in objFolder.Items

objExcel.Cells(intRow, 1).Value = objFolder.GetDetailsOf(strFileName, 0)

objExcel.Cells(intRow, 2).Value = objFolder.GetDetailsOf(strFileName, 8)

intRow = intRow + 1

Next

 

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

objExcel.Selection.Interior.ColorIndex = 19

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 Find Clients Not Reporting A Serial Number To Excel

 

This VBS script will take a site server name and site code via input dialog boxes and will send the machine names to Excel that do not have a serial number present in the SMS database.

 

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 = "Serial Number"

 

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 Distinct SD.Name0, SN.SerialNumber00" & _

" From v_R_System SD" & _

" Join System_Enclosure_Data SN  On SN.MachineID = SD.ResourceID" & _

" Where SD.Client0 = 1" & _

" And SN.SerialNumber00 = 'Not Available' Or SN.SerialNumber00 Is Null", 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("SerialNumber00").Value

If objExcel.Cells(intRow, 2).Value = "" Then

objExcel.Cells(intRow, 2).Value = "NULL"

End If

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:

SQL Query To List Add And Remove Programs For A Specified Machine Excluding Updates And Hot Fixes

 

This SQL Query will allow you to list the installed applications registered in the Add and Remove Applications applet for a specified machine excluding those applications such as Security Updates and Hot fixes and other system updates.

 

SQL Query:

 

Select

AP.DisplayName0 'Display Name',

IsNull(AP.Version0, '') Version

 

From v_R_System SD

Join v_Add_Remove_Programs AP on SD.ResourceID = AP.ResourceID

 

Where SD.Name0 = 'MachineName'

And AP.DisplayName0 Not Like '%Security Update%'

And AP.DisplayName0 Not Like '%Update For%'

And AP.DisplayName0 Not Like '%Hotfix%'

 

Order By AP.DisplayName0

 

 

 

 

Posted by dhite | with no comments
Filed under:

A Maverick

 

Samuel Augustus Maverick (1803– 1870) was a Texas cattleman from whom the term Maverick originated. In the west it was a custom and still is to some extent to brand your cattle so that you know they are yours. Because he thought that branding was cruel he refused to brand his cattle and he would scour Texas for unbranded cattle and pen them up and claim they were his even if they we not.

 

Unbranded cattle were traditionally considered the property of the first person who found and branded them.  The term was originally meant to apply to an unbranded cow which was known as “A Maverick“ but today is usually applies to someone who plays by their own rules.

 

 

 

Posted by dhite | with no comments
Filed under:

Bits And Bytes Conversion Tables

 

In computer systems a byte is a binary unit of measurement used to refer to disk storage space in a hard disk drive or Random Access Memory (RAM) memory on computer systems.

 

It takes 8 Bits to create one Byte where a Bit is also a binary digit consisting of a value of 0 or 1. For example 10101010, 00000000, 11111111 are all 8 bits long and form 1 Byte. Put simply a Byte is a collection of Bits.

 

The chart directly below will provide you with the conversions and the second chart shows you to abbreviations for each.

 

Unit

Equals

1 Bit

 Binary Digit

8 Bits

 1 Byte

1024 Bytes

 1 Kilobyte

1024 Kilobytes

 1 Megabyte

1024 Megabytes

 1 Gigabyte

1024 Gigabytes

 1 Terabyte

1024 Terabytes

 1 Petabyte

1024 Petabytes

 1 Exabyte -

1024 Exabytes

 1 Zettabyte

1024 Zettabytes

 1 Yottabyte

1024 Yottabytes

 1 Brontobyte

 

Abbreviations

 

Unit

Abbreviation

Bit

b

Byte

B

Kilo Byte

KB

Mega Byte

MB

Giga Byte

GB

Tera Byte

TB

Peta Byte

PB

Exa Byte

EB

Zetta Byte

ZB

Yotta Byte

YB

Bronto Byte

BB

 

 

 

 

Posted by dhite | 1 comment(s)
Filed under: ,

myITforum Shared User Group Material

 

The myITforum shared user group materials page gives you the tools and access needed to “Upload and download shared presentations (PPTs), videos, meeting notes, etc. — basically anything that is required to host and hold a User Group meeting.  Share your User Group materials and others will follow, giving you ideas and information for your own next meeting.”

 

If you are a user group presenter I urge you to upload your content here for the benefit of others. If you are a user group member looking for content stop by here and see what topics others are giving presentations on.

 

myITforum Shared User Group Material

http://myitforum.com/cs2/files/folders/ugfodder/default.aspx

 

 

 

 

Posted by dhite | with no comments
Filed under:

Fabio Cozzolino’s SQL Script Generator 0.1.3123

 

This is a freeware download of the SQL Script Generator by Fabio Cozzolino.

 

SQL Script Generator is a tool designed to create or generate Insert and Update statements into SQL scripts. With SQL Script Generator you can create scripts to copy data from one database to another.

 

Screen Print:

http://www.softpedia.com/screenshots/SQL-Script-Generator_1.png

 

SQL Script Generator 0.1.3123:

http://www.codeplex.com/sqlgen/Release/ProjectReleases.aspx?ReleaseId=15458

 

 

 

 

Posted by dhite | with no comments

Using ConfigMgr 2007 To Capture Microsoft Windows Media Player Media Files

 

Software Inventory in ConfigMgr 2007 as well as in the previous versions - SMS 2.0 and SMS 2003 - can be harnessed to capture application executable (Exe) file extensions by default. However you can always add file extensions such as Outlook Personal Folder Files (PST) files, Initialization and Configuration Files (INI) files, WinRAR Compressed Archive (RAR) files and Compressed Archive (ZIP) files just to name a few to see what is installed on client resources in your infrastructure environment. 

 

Any time you have clients with Microsoft Windows Media Player installed and they have access to the internet or removable media chances are that they will begin using the resources at their disposal even if it is frowned upon. Listening to music on your computer is not distractive or a big time waster and it is no different than listening to a radio in your office and neither one are uncommon today. Watching movies like Juno or watching the antics of Harold and Kumar the other hand can be disruptive and a time waster when employees are on the clock.

 

From an infrastructure standpoint both music and movies can affect the environment especially where shared resources such as users home shares and departmental shares are concerned. The problem is not so much that the employees are wasting time and are not being as productive as they should be. The real problem is that users seem to have the need to keep and store their digital media on their local machines or on shared resources and therein lays the problem. This can even cost the company money when they have to expand the disk space or buy additional disks when the resource run low or out of physical disk space.

 

To find machines and users that are storing Windows Media Player media files on shares or their local machines use the chart below and add the file type file extensions to your Software Inventory Client Agent Inventory Collection.     

 

Microsoft Windows Media Player File Extensions

 

File Extension

Description

AIF

Audio Interchange File Format

AIFC

Audio Interchange File Format

AIFF

Audio Interchange File Format

AVI

Audio Visual Interleave

CDA

CD Audio Track

DRV-MS

Microsoft Digital Video Recording

IVF

Indeo Video Technology

M3U

M3U

MOV

QuickTime Content

MP2

MPEG Audio Layer II

MP3

MPEG Audio Layer III

MP4

MPEG-4

MPA

MPEG Audio Layer II

QT

QuickTime content

RA

RealNetworks content

RAM

RealNetworks content

WAV

Audio for Windows

WAX

Windows Media Audio Redirector

WM

Windows Media Video

WMA

Windows Media Audio

WMD

Windows Media Download Package

WMV

Windows Media Video

WMX

Windows Media Redirector

WPL

Windows Media Player Playlist

WVX

Windows Media Video Redirector

 

Additional File Type And Extension Information:

 

File Type

File Extension

Audio Interchange File Format (AIFF) audio files

.aif, .aifc, and .aiff

CD audio disc

.cda

DVD-Video disc

.vob

JPEG picture file

.jpg

Macromedia Flash animation file

.swf

Microsoft Recorded TV Show

.dvr-ms

MP3 audio files

.mp3 and .m3u

MPEG video files

.mpeg, .mpg, .m1v, .mp2, .mpa, .mpe, .mp2v, and .mpv2

Musical Instrument Digital Interface (MIDI) audio files

.mid, .midi, and .rmi

Windows audio and video files

.avi and .wav

Windows Media audio and video files

.asf, .asx, .wax, .wm, .wma, .wmd, .wmp, .wmv, .wmx, .wpl, and .wvx

Windows Media Player skin file

.wmz

 

 

 

Posted by dhite | with no comments
Filed under:

By Request Script To Send Service Display Name And Path Name To A Text File

 

This By Request VBS script will send service display names and paths to a text file.

 

VBS Script:

 

strComputer = InputBox ("Enter Machine Name")

 

Const ForAppending = 8

 

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objTextFile = objFSO.OpenTextFile("Output.Txt", ForAppending, True)

 

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

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

 

For Each objItem in colItems

objTextFile.WriteLine(objItem.DisplayName & ": " & objItem.PathName)

Next

 

objTextFile.Close

MsgBox "Done"

 

 

 

Posted by dhite | with no comments
Filed under:

Notable Liars

 

My wife is fond of saying “You can lock up a thief, but you can’t lock up a liar.” And my Mother was fond of saying “You can go to Hades for lying the same as you can for stealing”. So without further ado here are some of the people who cannot be locked up but will go to Hades according to my wife and mother:

 

Bill Clinton The 42nd President of the United States. Lied under oath about his relationship with Monica Lewinsky and subsequently, in 1998, became the second president in U.S. history (the first was Andrew Johnson) to be impeached by the House of Representatives.

 

Richard Nixon The 37th President of the United States. After it came to light that he had been involved in illegal activities, including wiretapping and harassment of political opponents in the Watergate scandal, Nixon lied and tried to cover up the misdeeds. The truth eventually came to light and he resigned before he could be impeached.

 

James Frey After his autobiography A Million Little Pieces became a bestseller thanks to Oprah Winfrey selecting it for her book club, it was discovered that important parts of the book had been fabricated. After much controversy, Frey appeared on the Oprah Winfrey Show for the second time on January 26, 2006 and claimed that the "demons" that had driven him to abuse alcohol and drugs were the same ones that had led him to invent events in his autobiography. Oprah told him: "I feel that you betrayed millions of readers."

 

Jayson Blair In 2003, the New York Times reporter was caught plagiarizing and making up parts of his stories. He resigned and published a book in 2004 called Burning Down My Masters' House: My Life at the New York Times. In the book, he blames his behavior on a past battle with bipolar disorder and drug problems.

 

Janet Cooke Washington Post journalist Cooke won a Pulitzer Prize for a story called 'Jimmy's World," about an 8-year-old heroin addict. The only trouble was that she had created the entire story out of thin air. Once it was discovered, Cooke resigned and returned the Pulitzer. She has since sold the movie rights to her story.

 

Baron Münchhausen A German baron who served in the military and returned home with tall tales about his adventures. He reportedly told people that he'd travelled to the Moon, ridden cannonballs, and escaped from a swamp by pulling himself out by his own hair. Two psychological disorders are named after him. Munchausen syndrome is a disorder in which someone feigns illness in order to get attention. Munchausen syndrome by proxy is a disorder in which a caregiver (usually the mother) fakes or induces illness in his or her child or in another person in his or her care in order to gain attention and sympathy.

 

 

 

Posted by dhite | with no comments
Filed under:

20 Questions To Test Your Trivia Memory

 

Here's a little quiz to see how much you remember about some less-than-important things from a few decades back. Even the wrong answers may bring back a memory or two.

 

1. What builds strong bodies 12 ways?

 

A. Flintstones vitamins

B. The bunmaster

C. Spaghetti

D. Wonder Bread

E. Orange Juice

F. Milk

G. Cod Liver Oil

 

2. Be fore he was Muhammed Ali, he was...

 

A. Sugar Ray Robinson

B. Roy Orbison

C. Gene Autry

D. Rudolph Valentino

E. Fabian

F. Mickey Mantle

G. Cassius Clay

 

3. Pogo, the comic strip character said, 'We have met the enemy and...

 

A. It's you

B. He is us

C. It's the Grinch

D. He wasn't home

E. He's really mean

F. We quit

G. He surrendered

 

4. Good night, David.

 

A. Good night, Chet

B. Sleep well

C. Good Night, Irene

D. Good Night, Gracie

E. See you later, alligator

F. Until tomorrow

G. Good night, Steve

 

5. You'll wonder where the yellow went,

 

A. When you use Tide

B. When you lose your crayons

C. When you clean your tub

D. If you paint the room blue

E. If you buy a soft water tank

F. When you use Lady Clairol

G. When you brush your teeth with Pepsodent

 

6. Before he was the Skipper's Little Buddy, Bob Denver was Dobie's friend,

 

A. Stuart Whitman

B. Randolph Scott

C. Steve Reeves

D. Maynard G. Krebbs

E. Corky B. Dork

F. Dave the Whale

G. Zippy Zoo

 

7. Liar, liar...

 

A. You're a liar

B. Your nose is growing

C. Pants on fire

D. Join the choir

E. Jump up higher

F. On the wire

G. I'm telling Mom

 

8. Meanwhile, back in Metropolis, Superman fights a never ending battle for truth, justice and...

 

A. Wheaties

B. Lois Lane

C. TV ratings

D. World peace

E. Red tights

F. The American way

G. News headlines

 

9 . Hey, kids, what time is it?

 

A. It's time for Yogi Bear

B. It's time to do your homework

C. It's Howdy Doody Time

D. It's Time for Romper Room

E. It's bedtime

F. The Mighty Mouse Hour

G. Scooby Doo Time

 

10. Lions and tigers and bears...

 

A. Yikes

B. Oh no

C. Gee whiz

D. I'm scared

E. Oh My

F. Help Help

H. Let's run

 

11. Social Activist Jerry Rubin advised us never to trust anyone

 

A. Over 40

B. Wearing a uniform

C. Carrying a briefcase

D. Over 30

E. You don't know

F. Who says, 'Trust me'

G. Who eats tofu

 

12. NFL quarterback who appeared in a television commercial wearing women's stockings.

 

A. Troy Aikman

B. Kenny Stabler

C. Joe Namath

D. Roger Stauback

E. Joe Montana

F. Steve Young

G. John Elway

 

13. Bryl Cream...

 

A. Smear it on

B. You'll smell great

C. Tame that cowlick

D. Greaseball heaven

E. It's a dream

F. We're your team

G. A little dab'll do ya

 

14. I found my thrill...

 

A. In Blueberry muffins

B. With my man, Bill

C. Down at the mill

D. Over the windowsill

E. With thyme and dill

F. Too late to enjoy

G. On Blueberry Hill

 

15. Before Robin Williams, Peter Pan was played by

 

A. Clark Gable

B. Mary Martin

C. Doris Day

D. Errol Flynn

E. Sally Fields

F. Jim Carey

G. Jay Leno

 

16. Name the Beatles

 

A. John, Steve, George, Ringo

B. John, Paul, George, Roscoe

C. John, Paul, Stacey, Ringo

D. Jay, Paul, George, Ringo

E. Lewis, Peter, George, Ringo

F. Jason, Betty, Skipper, Hazel

G. John, Paul, George, Ringo

 

17. I wonder, wonder, wonder, who

 

A. Who ate the leftovers?

B. Who did the laundry?

C. Was it you?

D. Who wrote the book of love?

E. Who I am?

F. Passed the test?

G. Knocked on the door?

 

18. I'm strong to the finish

 

A. Cause I eats my broccoli

B. Cause I eats me spinach

C. Cause I lift weights

D. Cause I'm the hero

E. And don't you forget it

F. Cause Olive Oyl loves me

G. To outlast Bruto

 

19. When it's least expected, you're elected, you're the star today...

 

A. Smile, you're on Candid Camera

B. Smile, you're on Star Search

C. Smile, you won the lottery

D. Smile, we're watching you

E. Smile, the world sees you

F. Smile, you're a hit

G. Smile, you're on TV

 

20. What do M & M's do?

 

A. Make your tummy happy

B. Melt in your mouth, not in your pocket

C. Make you f at

D. Melt your heart

E. Make you popular

F. Melt in your mouth, not in you r hand

G. Come in colors

 

Note: For the answers see the comments.

 

 

Posted by dhite | 1 comment(s)
Filed under:

VBS Script To Send Remote Desktop Connection History To Excel

 

This VBS script will allow you to enter a local or remote machine name into an input dialog box and will read the registry key containing the list of the Most Recently Used (MRU) history for your Remote desktop connections. The results will then be sent to an Excel spreadsheet listed alphabetically.

 

VBS Script:

 

strComputer = InputBox ("Enter Machine Name")

 

Const Hkey_Current_User = &H80000001

Const REG_SZ = 1

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

objExcel.Cells(1, 1).Value = "Connection"

 

Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")

strKeyPath = "Software\Microsoft\Terminal Server Client\Default"

objRegistry.EnumValues HKEY_Current_User, strKeyPath, arrDataValue, arrValueTypes

 

For i = 0 to UBound(arrDataValue)

strData = arrDataValue(i)  

strMRU = arrDataValue(i)

 

objRegistry.GetStringValue HKEY_Current_User,strKeyPath, strMRU,strValue

objExcel.Cells(intRow, 1).Value = strValue

intRow = intRow + 1

Next

 

objExcel.Range("A1").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 The Current Status Of A Specified Printer Share

 

This VBS script will retrieve the printer status for a hard coded print server name. To prompt for a Printer name replace the line that reads: strPrinterShare = "HPPSC160"

with strPrinterShare = InputBox("Enter Printer Share Name")

 

VBS Script:

 

strComputer = InputBox("Enter Print Server Name")

strPrinterShare = InputBox ("Enter Printer Share Name")

strPrinterShare = "HPPSC160"

 

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

Set colItems = objWMIService.ExecQuery("Select * from Win32_Printer Where ShareName = '" & strPrinterShare & "'")

 

For Each objItem in colItems

Select Case objItem.DetectedErrorState

Case 0 Status = "On line"

Case 1 Status = "Paused"

Case 2 Status = "Pending Deletion"

Case 3 Status = "Error"

Case 4 Status = "Paper Jam"

Case 5 Status = "Paper Out"

Case 6 Status = "Manual Feed"

Case 7 Status = "Paper Problem"

Case 8 Status = "Offline"

Case 256 Status = "IO Active"

Case 512 Status = "Busy"

Case 1024 Status = "Printing"

Case 2048 Status = "Output Bin Full"

Case 4096 Status = "Not Available"

Case 8192 Status = "Waiting"

Case 6384 Status = "Processing"

Case 32768 Status = "Initializing"

Case 65536 Status = "Warming Up"

Case 131072 Status = "Toner Low"

Case 262144 Status = "No Toner"

Case 524288 Status = "Page Punt"

Case 1048576 Status = "User Intervention"

Case 2097152 Status = "Out of Memory"

Case 4194304 Status = "Door Open"

Case 8388608 Status = "Server Unknown"

Case 16777216 Status = "Power Save"

Case Else Status = "UNKNOWN"

End Select

 

If Err.Number = 0 Then

MsgBox objItem.ShareName & " (" & objItem.Name &") "  & "Is: " & Status

Else

MsgBox "The Account: " & UCase(strLogonName) & " Was Not Found"

End If

Next

 

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Retrieve SMS Services Status

 

This VBS script will read a text file called MachineList.Txt and will write all of the SMS services information to an excel spreadsheet. If the service state is stopped the results will be written in red.

 

VBS Script:

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

Set Fso = CreateObject("Scripting.FileSystemObject")

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

Do While Not (InputFile.atEndOfStream)

strComputer = InputFile.ReadLine

 

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

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

objExcel.Cells(1, 3).Value = "Current State"

 

servicename = "SMS_"

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

Set colItems = objWMIService.ExecQuery("Select * From Win32_Service Where Name Like '" & servicename & "%'")

 

For Each objItem in colItems

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

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

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

If objExcel.Cells(intRow, 3).Value = "Stopped" Then

objExcel.Cells(intRow, 3).Font.ColorIndex = 3

End If

 

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

 

MsgBox "Done"

 

 

 

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