November 2006 - Posts

VBS Script To Export SMS Web Reports To Microsoft Word

 

This Vbs script will take an SMS site server name and site code from an input box and then enumerate all of the SMS Web Reports on that server. It will then add them to a Microsoft Word document that you can save for future reference. You can also save the document as a webpage or as an XML document if you are using Microsoft Word 2003.

 

Note: The script uses the SMS_Report class and exposes its SQLQuery lazy property by using the GET instance for the object property and links the Report ID for the appropriate reports. For more information on lazy properties see the link at the end of this post.

 

Vbs Script:

 

strComputer = InputBox ("Enter Site Server Name")

strSiteCode = InputBox("Enter Site Code")

 

Set objWord = CreateObject("Word.Application")

objWord.Visible = True

 

Set objDoc = objWord.Documents.Add()

Set objSelection = objWord.Selection

 

objSelection.Font.Bold = True

objSelection.TypeText "SMS Web Reports For " & UCase(strComputer)

objSelection.Font.Bold = False

objSelection.TypeParagraph()

objSelection.TypeText "Report Created: " & Date

objSelection.TypeParagraph()

objSelection.TypeParagraph()

 

Set objWMIService = GetObject("winmgmts://" & strComputer & "\root\sms\site_" & strSiteCode)

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

 

For Each objItem in colItems

ReportQuery(objItem.ReportID)

Next

 

Function ReportQuery(ReportID)

Set lazyproperties = objWMIService.Get("SMS_Report.ReportID=" & ReportID)  

objSelection.Font.Bold = True

objSelection.TypeText lazyproperties.Name

objSelection.Font.Bold = False

objSelection.TypeParagraph()

objSelection.TypeParagraph()

 

objSelection.TypeText lazyproperties.SQLQuery

objSelection.TypeParagraph()

objSelection.TypeParagraph()

End Function

 

MsgBox "Done"

 

Those Lazy SMS Properties:

http://myitforum.com/cs2/blogs/dhite/archive/2006/11/17/those-lazy-sms-properties.aspx

 

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

Vbs Script To Enumerate A Subnet Range And Determine Which Machines Are SMS Clients

 

Use this Vbs script to enumerate a subnet range or range of IP addresses to determine which machines are or are not SMS clients and send the results to Excel. It will also attempt to determine the IP address and Machines Name for each IP address as well.

 

Note: The Subnet range must have the following syntax xxx.xxx.xxx. with the trailing “.” at the end of the first Input box prompt.

 

To make the script input boxes easier to understand I have added examples for each and the input box will be auto populated with them Change them as needed.

 

Vbs Script:

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

objExcel.Cells(1, 1).Value = "IP Address"

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

objExcel.Cells(1, 3).Value = "SMS Client"

 

strSubnet = InputBox("Enter Subnet Range", "strSubnet", "192.168.1.")

intStartingAddress = InputBox("Enter Start Address", "intStartingAddress", "0")

intEndingAddress = InputBox("Enter End Address", "intEndingAddress", "255")

 

For i = intStartingAddress to intEndingAddress

strTarget = strSubnet & i

 

Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._

ExecQuery("select Replysize from Win32_PingStatus where address = '" & strTarget & "'")

 

For Each objItem in objPing

If IsNull(objItem.ReplySize) Then

IsConnectible = False

Else

 

On Error Resume Next

 

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strTarget & "\root\cimv2")

Set colCompSystems = objWMIService.ExecQuery("Select * From " & "Win32_ComputerSystem")

For Each objCompSystem In colCompSystems

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

objExcel.Cells(intRow, 2).Value = UCase(objCompSystem.Name)

Next

 

Set objWMIService = GetObject("winmgmts://" & strTarget & "/root/ccm")

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

If Err.Number = 0 Then

objExcel.Cells(intRow, 3).Value = "YES"

intRow = intRow + 1

Else

objExcel.Cells(intRow, 3).Value = "NO"

intRow = intRow + 1

End If

End If

Next

 

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

objExcel.Selection.Interior.ColorIndex = 19

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

Next

 

Set objExcel = Nothing

Set objPing = Nothing

Set objWMIService = Nothing

Set colCompSystems = Nothing

Set smsClient = Nothing

 

Wscript.Echo "Done"

Posted by dhite | with no comments
Filed under:

Counting The Advanced Clients Machines In Your SMS Database

 

This SQL query will count all of the SMS advanced client machines in your SMS database by Active Directory (AD) site. It will also display the client version number as well as the AD site name.

 

SQL Query:

 

Select

AD_Site_Name0 'Active Directory Site',

Client_Version0 'SMS Advanced Client Version Number',

Count(*) 'Totals'  

From v_R_System 

Where Client0 = 1

And Client_Type0 = 1

group by AD_Site_Name0, Client_Version0

order by AD_Site_Name0, Client_Version0

 

Posted by dhite | with no comments
Filed under:

IP Configuration Command Line Switches

 

There are a number of ways that you can troubleshoot TCP/IP configuration issues for your SMS clients. The standard process for troubleshooting these issues is using the Ipconfig command line utility from the command prompt on the machine(s) in question.

 

Listed here you can see all of the available Ipconfig command line switches available to you for troubleshooting purposes.

 

Ipconfig /all

This command line switch will display the “Detailed” IP configuration of the client machine.

 

Ipconfig /release

This command line switch will release the current IP address on the client machines network interface card (NIC).

 

Ipconfig /renew

This command line switch will renew the current IP address on the client machines NIC card.

 

Ipconfig /flushDns

This command line switch will flush or purge the client machines DNS cache.

 

Ipconfig /registerDns

This command line switch will refresh all of the NIC cards leased IP addresses and will re-register the DNS names.

 

Ipconfig /displayDns

This command line switch will display the DNS cache records.

 

Posted by dhite | with no comments
Filed under:

Taking The Heat Off The SMS Service Account

 

The SMS Service account in both SMS 2.0 and 2003 must be used sparingly and only when necessary. Just as we try not to use the Administrator account on our domain servers we should try and take the heat off the SMS service account as well.

 

Because the service account and the administrations account are very powerful accounts and can wreak havoc if misused we must protect them as best we can. The SMS service account in particular has many process threads that rely on it and should be protected.

 

To take the heat off the SMS service account you should have the following accounts created otherwise the SMS service account will manage them:

 

Client Push Installation account – This account is used by the Client Configuration Manager to install the SMS client software on your machines.

 

Site Address account – This account is used for site to site communication and data transfers between sites in a parent child configuration.

 

Site System Connection account – This account is used by the SMS Site server(s) when connecting to its site systems.

 

Posted by dhite | with no comments
Filed under:

By Request: Using A Message Box For A Yes Or No Input Response

 

Use this Vbs script to get user input from a Vbs Script:

 

MsgBoxReply = Msgbox("Ready To Visit SpongeBob SquarePants ?",vbYesNo , "SpongeBob SquarePants Rocks !")

 

If MsgBoxReply = vbYes Then

' Place Your "YES" Code Here And Remove The Line Below.

MsgBox "Ok Then Tell Gary Hello !"

 

Else

' Place Your "NO" Code Here And Remove The Line Below.

MsgBox "Patrick Will Sure Miss You !"

End If

 

 

Note: You can also use the display button value as opposed to the constant for the Yes and No buttons (vbYesNo) in the script above by replacing vbYesNo with the Value of  4 or

as in the Additional Button Display Options listed at the end of this post.

  

  • Additional Button Display Options

Constant: vbOKOnly

Value: 0

Buttons: OK only

 

Constant: vbOKCancel

Value: 1

Buttons: OK and Cancel

 

Constant: vbAbortRetryIgnore

Value: 2

Buttons: Abort, Retry, and Ignore

 

Constant: vbYesNoCancel

Value: 3

Buttons: Yes, No, and Cancel

 

Constant: vbYesNo

Value: 4

Buttons: Yes and No

 

Constant: vbRetryCancel

Value: 5

Buttons: Retry and Cancel

 

 

Posted by dhite | with no comments
Filed under:

American Presidential Oddities

 

  • Abraham Lincoln:  Had a twangy high-pitched voice.
  • Andrew Jackson: Made his wife, Rachel, a bigamist by illegally marrying her before she’d divorced her first husband.
  • Andrew Johnson: Loved the circus.
  • Benjamin Harrison: Had the first electric lights in the White House, but was scared to turn them on or off for fear of electrocution. Instead, he made the servants do it.
  • Bill Clinton: Was eight years old when he was beaten up by a sheep. That was the day, according to his autobiography, that he learned that he could take a hard hit.
  • Calvin Coolidge: While president, enjoyed riding on a mechanical horse and whooping like a cowboy. He also thought it was great fun to hit the buzzer for the servants and then hide.
  • Chester A. Arthur: Had over 80 pairs of pants and insisted on changing several times a day.
  • Dwight D. Eisenhower: Hated cats and in retirement in Gettysburg, Pennsylvania, he enjoyed shooting at them as they came near his house.
  • Franklin D. Roosevelt: Had a collection of 25,000 stamps. He added to it by simply having the Postmaster General and State Department mail him every new issue.
  • Franklin Pierce: Was pals with author Nathaniel Hawthorne. In fact, the two were vacationing together in the White Mountains when Hawthorne died in his sleep.
  • George H.W. Bush: Was the first president to use any of the following words in his inaugural addresses: "cocaine," bacteria," and "easygoingness."
  • George W. Bush: Was the first sitting president to acquire an iPod and correspondingly the first to admit a weakness for Blackie & the Rodeo Kings.
  • George Washington: He was a consistent disappointment to his mother, Mary. She complained frequently to anyone who would listen that he was lax in supporting her and, much to his embarrassment, once begged the Virginia legislature for a little spending money.
  • Gerald R. Ford: Was originally named Leslie Lynch King Jr. after his biological father, who abandoned the family when Ford was an infant. The next time Ford saw him was 15 years later, when Leslie Sr. showed up without warning and gave the kid 25 bucks.
  • Grover Cleveland: Had a prosthetic jaw and an illegitimate daughter, neither of which seriously affected his popularity. He’s also the only president to have been elected to two non-consecutive terms.
  • Harry S Truman: Once wrote a threatening letter to the music critic of the Washington Post in response to a negative review of his daughter’s voice recital, stating "I never met you, but if I do, you’ll need a new nose …"
  • Herbert Hoover: He and his wife were both proficient in Chinese and would often use it to talk privately in the presence of guests.
  • James A. Garfield: Was a former classics teacher, could simultaneously write Greek with one hand and Latin with the other.
  • James Buchanan: Had one eye set higher in his head than the other, so he walked around with his neck cocked to one side.
  • James K. Polk: Was plagued with diarrhea throughout his single term. He eventually died of what he described as a "derangement of the stomach and bowels."
  • James Madison: "Hail to the Chief" was written specifically for James Madison, because he was so short that no one ever noticed when he entered the room.
  • James Monroe: Was driven to the brink of bankruptcy by his spendthrift wife and daughters; Monroe’s wife then compounded matters by developing an expensive, and eventually fatal, illness.
  • Jimmy Carter: Wrote a children’s book called "The Little Baby Snoogle-Fleejer."
  • John Adams:  Spoke with a lisp because he stubbornly refused to wear dentures.
  • John F. Kennedy: Only watched the first halves of movies. Then he’d get bored.
  • John Quincy Adams: Was partial to skinny-dipping in the Potomac and was once surprised mid swim by an enterprising female reporter, who forced him into a naked interview.
  • John Tyler: Holds the presidential paternity record. He had 14 children live to maturity, the youngest born when Tyler was 70.
  • Lyndon B. Johnson: He proposed to his wife, Lady Bird, on their first date, a breakfast, then bought her a wedding ring for $2.50.
  • Martin Van Buren: Liked to gamble on the outcome of elections.
  • Millard Fillmore: Had a historic audience with the pope shortly before being nominated for president on a violently anti-Catholic ticket.
  • Richard M. Nixon: Loved football. As president, he’d occasionally called up NFL coaches to chat and offer strategic advice.
  • Ronald Reagan: In his 1965 personal memoir, Where’s the Rest of Me? Opens with the line, "The story begins with the close up of a bottom."
  • Rutherford B. Hayes: Was a huge fan of croquet.
  • Theodore Roosevelt: His mother and first wife died on the same day, in the same house, on the fourth anniversary of his engagement, which was also Valentine’s Day.
  • Thomas Jefferson: Despite his otherwise refined tastes, was a notoriously lousy dresser with poor posture. He once shocked a British minister with his slovenly appearance.
  • Ulysses S. Grant: Changed his name from Hiram Ulysses because he was ashamed of the initials H.U.G. Also, he hated music.
  • Warren G. Harding: Kept his romantic trysts in the closet - literally. He often met his mistress in a closet off the presidential office.
  • William Henry Harrison: Was the biggest vote getter in the American history if calculating by what percentage of eligible voters chose him - but was only president for 31 days.
  • William Howard Taft: Weighed 326 pounds and got stuck in the White House bathtub. He had a bigger one installed.
  • William McKinley: His wife was an epileptic whose contorted face he sometimes covered up with a handkerchief during formal dinner parties.
  • Woodrow Wilson: Was a gifted mimic fond of telling racist jokes in Irish dialect. He also liked to imitate drunks.
  • Zachary Taylor: Received so much fan mail after his Mexican War victories that he started refusing all postage-due letters. As a result, he didn’t find out he’d won the Whig nomination for president for almost a month.

 Note: Thanks to Alex for sending this to me and allowing me to modify and post it here.

 

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

Alternate Means Of Saying Someone Is lacking Sufficient Intelligence

 

Have you ever had one of those days when you wish you could call someone “Stupid” or a “Moron” and cannot find it in your heart to just come out and say so? Well then this list is for you. Here you will find a listing of some alternate means of calling someone a “Stupid Moron”:

 

Note: Your End Losers, I mean End Users (And other customers) are under no circumstances to be called “Stupid” or “Morons” or any of the alternatives below.

 

  • A few beers short of a six-pack.
  • A few clowns short of a circus.
  • A few feathers short of a whole duck.
  • A few fries short of a Happy Meal.
  • A few peas short of a casserole.
  • All foam, no beer.
  • An experiment in Artificial Stupidity.
  • An intellect rivaled only by that of garden tools.
  • As smart as bait.
  • Body by Fisher - brains by Mattel.
  • Chimney's clogged.
  • Couldn't pour water out of a boot with instructions on the heel.
  • Doesn't have all his cornflakes in one box.
  • Doesn't have all his dogs on one leash.
  • Doesn't know much, but leads the league in nostril hair.
  • Dumber than a box of hair.
  • Elevator doesn't go all the way to the top floor.
  • Forgot to pay his brain bill.
  • Has an IQ of 2, takes 3 to grunt.
  • He fell out of the stupid tree and hit every branch on the way down.
  • Her sewing machine's out of thread.
  • His antenna doesn't pick up all the channels.
  • His belt doesn't go through all the loops.
  • If he had another brain, it would be lonely.
  • Missing a few buttons on his remote control.
  • No grain in the silo.
  • One Fruit Loop shy of a full bowl.
  • One taco short of a combination plate.
  • Played football without a helmet.
  • Proof that evolution CAN go in reverse..
  • Receiver is off the hook.
  • Several nuts short of a full pouch.
  • Skylight leaks a little.
  • Slinky's kinked.
  • Strong, like Bear... Smart, like Tractor.
  • Surfing in Nebraska.
  • The cheese slid off his cracker.
  • The wheel's spinning, but the hamster's dead.
  • Too much yardage between the goal posts.
  • Warning: Objects in mirror are dumber than they appear.

 

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

Those Lazy SMS Properties!

 

Some of the object properties within SMS are lazy. To be more precise they are ‘Lazy Properties’. This simply means that the data exist but it is not exposed to the SMS Query builder or the SMS console. However it can be accessed using WMI or WbemTest.

 

As an example in the Sms_Advertisement class the AssignedSchedule and StartTime properties are lazy properties. Within the Sms_Pdf_Package the Icon property is an array containing icon data and it is also a lazy property.

 

As a rule the data is meaningless numeric data and therefore useless to you. And as I mentioned they can be accessed through various programming languages as well as a WMI class viewer.

 

Programmatically you can use the Get instance for the object to get the data as in the example below taken from the link at the bottom of this page.

 

Set colAdvertisements = objSWbemServices.ExecQuery("Select * From SMS_Advertisement")

 

For Each objAdvert In colAdvertisements

WScript.Echo "ActionInProgress = " & objAdvert.ActionInProgress

WScript.Echo "AdvertFlags = " & objAdvert.AdvertFlags

WScript.Echo "AdvertisementID = " & objAdvert.AdvertisementID

WScript.Echo "AdvertisementName = " & objAdvert.AdvertisementName

 

'For the lazy properties, get the advertisements individually.

Set lazyproperties = objSWbemServices.Get("SMS_Advertisement.AdvertisementID='" & ObjAdvert.advertisementid & "'")

WScript.Echo "Assigned Schedule = {"      

For i=0 to ubound(lazyproperties.assignedschedule,1)

 

WScript.Echo " instance of " & lazyproperties.Properties_("AssignedSchedule").Value(0).Path_.Class

WScript.Echo lazyproperties.Properties_("AssignedSchedule").Qualifiers_("CIMType")

WScript.Echo "   DayDuration: " & lazyproperties.AssignedSchedule(i).DayDuration

WScript.Echo "   Hourspan: " & lazyproperties.AssignedSchedule(i).HourSpan

WScript.Echo "   IsGMT: " & lazyproperties.AssignedSchedule(i).IsGMT

WScript.Echo "   StartTime: " & lazyproperties.AssignedSchedule(i).StartTime

WScript.Echo "AssignedScheduleEnabled = " & lazyproperties.AssignedScheduleEnabled

WScript.Echo "AssignedScheduleIsGMT = " & lazyproperties.AssignedScheduleIsGMT

 

Next

WScript.Echo "}"      

WScript.Echo "CollectionID = " & objAdvert.CollectionID

WScript.Echo "Comment = " & objAdvert.Comment

 

Next

  

How to Read Lazy Properties

http://www.microsoft.com/technet/prodtechnol/sms/sms2003/maintain/smsscript/script11.mspx?mfr=true

 

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

Vbs Script To Create Directories Using An Excel Spreadsheet

This Vbs script will create directory names contained in an Excel spreadsheet called C:\NewFolders.xls on a server share.

 

The Excel file must have one directory name per line in Column A as in the example below:

 

Folder1

Folder2

Folder3

 

Note: Be sure to change \\ServerName\ShareName\ as needed.

 

Vbs Script:

 

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objExcel = CreateObject("Excel.Application")

 

strPathExcel = "C:\NewFolders.xls"

objExcel.Workbooks.open strPathExcel

 

Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)

intRow = 1

 

Do Until objExcel.Cells(intRow, 1).Value = ""

strCN = Trim(objSheet.Cells(intRow, 1).Value)

If objFSO.FolderExists("\\ServerName\ShareName\" & strCN) Then

Else

objFSO.CreateFolder("\\ServerName\ShareName\" & strCN)

End If

 

intRow = intRow + 1

Loop

 

objExcel.Quit

Wscript.Echo "Done"

 

 

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

Finding All Installed Apps From Add And Remove Programs From A List Of Machines

 

Use the queries below to find the installed applications from the Add and Remove programs (MSI Installed) table for a list of machines.

 

SQL Query:

 

Select

System.Name0,

Programs.DisplayName00 Application,

Programs.Publisher00 Publisher,