October 2006 - Posts

Welcome Back Clarence Washington’s Win32Scripting Webpage

 

Back by popular demand is Clarence Washington’s Win32Scripting Webpage:

http://cwashington.netreach.net

 

Drop by the Discussion Lounge and welcome him back!

http://cwashington.netreach.net/community/lounge/default.asp

 

 

Posted by dhite | with no comments
Filed under:

Vbs Script To Gather Domain Logon Information To Excel

Use this Vbs script to gather domain login information and send the results to Excel.

 

Vbs script:

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

objExcel.Cells(1, 1).Value = "Login ID"

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

objExcel.Cells(1, 3).Value = "Domain Account"

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

objExcel.Cells(1, 5).Value = "Last Logon"

objExcel.Cells(1, 6).Value = "User Type"

objExcel.Cells(1, 7).Value = "Privileges"

objExcel.Cells(1, 8).Value = "Profile"

objExcel.Cells(1, 9).Value = "Script Path"

objExcel.Cells(1, 10).Value = "Description"

objExcel.Cells(1, 11).Value = "Home Directory Drive"

objExcel.Cells(1, 12).Value = "Home Directory"

objExcel.Cells(1, 13).Value = "Logon Server"

objExcel.Cells(1, 14).Value = "Number Of Logons"

objExcel.Cells(1, 15).Value = "Account Expires"

objExcel.Cells(1, 16).Value = "Bad Password Count"

objExcel.Cells(1, 17).Value = "Primary Group ID"

objExcel.Cells(1, 18).Value = "User Comment"

objExcel.Cells(1, 19).Value = "User ID"

 

On Error Resume Next

strComputer = "LocalHost" ' Change LocalHost to your PDC name

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

Set colItems = objWMIService.ExecQuery("Select * from Win32_NetworkLoginProfile Where FullName is not null")

 

For Each objItem in colItems

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

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

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

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

objExcel.Cells(intRow, 5).Value = WMIDateStringToDate(objItem.LastLogon)

objExcel.Cells(intRow, 6).Value = objItem.UserType

 

If objItem.Privileges = 0 Then objExcel.Cells(intRow, 7).Value = "Guest"

If objItem.Privileges = 1 Then objExcel.Cells(intRow, 7).Value = "(Domain)User"

If objItem.Privileges = 2 Then objExcel.Cells(intRow, 7).Value = "Administrator"

 

objExcel.Cells(intRow, 8).Value = objItem.Profile

objExcel.Cells(intRow, 9).Value = objItem.ScriptPath

objExcel.Cells(intRow, 10).Value = objItem.Description

objExcel.Cells(intRow, 11).Value = objItem.HomeDirectoryDrive

objExcel.Cells(intRow, 12).Value = objItem.HomeDirectory

objExcel.Cells(intRow, 13).Value = objItem.LogonServer

objExcel.Cells(intRow, 14).Value = objItem.NumberOfLogons

objExcel.Cells(intRow, 15).Value = WMIDateStringToDate(objItem.AccountExpires)

objExcel.Cells(intRow, 16).Value = objItem.BadPasswordCount

objExcel.Cells(intRow, 17).Value = objItem.PrimaryGroupId

objExcel.Cells(intRow, 18).Value = objItem.UserComment

objExcel.Cells(intRow, 19).Value = objItem.UserId

 

intRow = intRow + 1

Next

 

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

objExcel.Selection.Interior.ColorIndex = 19

objExcel.Selection.Font.ColorIndex = 11

objExcel.Selection.Font.Bold = True

objExcel.Cells.EntireColumn.AutoFit

 

Function WMIDateStringToDate(dtmWMIDate)

If Not IsNull(dtmWMIDate) Then

WMIDateStringToDate = CDate(Mid(dtmWMIDate, 5, 2) & "/" & _

Mid(dtmWMIDate, 7, 2) & "/" & Left(dtmWMIDate, 4) _

& " " & Mid (dtmWMIDate, 9, 2) & ":" & _

Mid(dtmWMIDate, 11, 2) & ":" & Mid(dtmWMIDate, _

13, 2))

End If

End Function

 

Set objExcel = Nothing

Set objWMIService = Nothing

 

Posted by dhite | with no comments
Filed under:

Get Machine Name And IP Address From List And Send To Excel

This Vbs script will read the machine names in a text file called MachineList.Txt and write the machine name and its corresponding IP address to an excel spreadsheet.

 

This can be useful for when you want to keep a record of the servers IP addresses in your organization for future reference.

 

VBS Script:

 

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 = "IP Address"

 

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 IpAddress From Win32_NetworkAdapterConfiguration Where IPEnabled=TRUE")

For Each objItem in colItems

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

Next

 

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

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

For Each objItem in colItems

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

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

 

loop

Set objWMIService  = Nothing

Set colItems = Nothing

Set objExcel  = Nothing

 

Wscript.Echo "Done"

 

Posted by dhite | with no comments
Filed under:

Locating Machines That Performed A Hardware Scan Within The Last Week

 

This SQL query will locate machines in your SMS inventory that have reported a hardware scan in the last week or 7 days.

 

Sql Query:

 

Select    

CS.Name0 'Machine Name',

WS.LastHwScan 'Inventory TimeStamp',

DateDiff(D, WS.LastHwScan,

GetDate()) 'Inventory Age In Days:)'

From WorkstationStatus_Data WS

Join System_Disc CS on WS.MachineId = CS.ItemKey

Where (DateDiff(D, WS.LastHwScan, GetDate()) >= 7)

 

Posted by dhite | with no comments
Filed under:

Troubleshooting Server locator Point Active Directory Publishing

 

When you extend the Active Directory (AD) schema for SMS 2003 your server locator point (SLP) is published in AD. If you do not extend the schema the server locator point will not be published in AD. If this is the case you must manually add it in Windows Internet Name Service (WINS) using Netsh (Or WinScl) from the command prompt on a Windows 2000 or greater server.

 

Follow the steps below to add your server locator point entry to the WINS database:

 

  • From the command prompt type “Netsh.exe” and press Enter.

 

  • Next type “Wins” and press Enter again

 

  • Next Type “Server” and press Enter. For a remote WINS server you must enter the server name as \\Server_Name or enter the WINS servers IP address.

 

  • Next enter the following:

 

  • Add name Name=SMS_SLP endchar=1A rectype=0 ip={static IP of your SLP}

 

 Next you should verify that the changes have been added successfully.

 

  • From the command prompt type “Netsh.exe” and press Enter.

  • Next type “Wins” and press Enter again

  • Next Type “Server” and press Enter. For a remote WINS server you must enter the server name as \\Server_Name or enter the WINS servers IP address.

 

  • Next enter the following:

 

  • Show Name name=SMS_SLP endchar=1A

 

Posted by dhite | with no comments
Filed under:

Retrieve User Accounts From A Remote Machine

 

This PowerShell script will list the User accounts on a remote machine. Change Machine_Name with the Domain controller, SMS server or SQL server you want to enumerate.

 

PowerShell Script:

 

Gwmi Win32_UserAccount -Comp Machine_Name |

Sort-Object Name |

Format-Table FullName, Name, Domain

 

Posted by dhite | with no comments
Filed under:

Terminal Server Printer Redirection Wizard Tool

 

Microsoft has a Terminal Server Printer Redirection Wizard Tool that can help you resolve Printer Redirection errors by scanning your Terminal server (TS) event logs in an automated process based on the MSKB article KB239088.

 

It does so by scanning the event logs for errors 1111, 1105, and 1006 with the source ‘TermServDevices’. If found it will, scan the TS registry for MINI version 3 drivers and prompt you to change the values for the failed driver redirection.

 

 

TSPDRW_Package.exe 1.0.80

http://www.microsoft.com/downloads/details.aspx?familyid=9AD27BE9-40DB-484F-862E-38A094EEEAF7&displaylang=en

 

Posted by dhite | with no comments
Filed under:

Reporting Services Scripter

 

Reporting Services Scripter is a .NET Windows Forms application that enables scripting and transfers of all Microsoft SQL Server Reporting Services catalog items to aid in transferring them from one server to another. It can also be used to easily move items on mass from one Reporting Services folder to another on the same server. Depending on the scripting options chosen, Reporting Services Scripter can also transfer all catalog item properties such as Descriptions, History options, Execution options (including report specific and shared schedules), Subscriptions (normal and data driven) and server side report parameters.

 

In order to run Reporting Services Scripter you need to have the .NET Framework 1.1 installed. In order to be able to run the generated command files or use the Transfer mode of deployment you will need the Reporting Services Management Tools installed, specifically the command line utility RS.EXE (both the SQL2000 and SQL2005 versions are required for full functionality)

 

Download Reporting Services Scripter (2.0.0.6)

http://www.sqldbatips.com/showarticle.asp?ID=62

 

 

Posted by dhite | with no comments

Get The Most Current Installed Version Of Microsoft .Net Framework

 

This by request script will return the latest installed version of the Microsoft .NET framework from the local host machine.

 

Vbs Script:

 

strComputer = "LocalHost"

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

 

Set colItems = objWMIService.ExecQuery("Select * from Win32_Product Where Caption Like '%NET Framework%'")

For Each objItem in colItems

Wscript.Echo objItem.Name, " Version ", objItem.Version

Next

 

Posted by dhite | with no comments
Filed under:

Microsoft Humor In Knowledge Base Articles

 

Computer Randomly Plays Classical Music

http://support.microsoft.com/?kbid=261186

 

SUMMARY

During normal operation or in Safe mode, your computer may play "Fur Elise" or "It's a Small, Small World" seemingly at random. This is an indication sent to the PC speaker from the computer's BIOS that the CPU fan is failing or has failed, or that the power supply voltages have drifted out of tolerance. This is a design feature of a detection circuit and system BIOSes developed by Award/Unicore from 1997 on.

 

MORE INFORMATION

Although these symptoms may appear to be virus-like, they are the result of an electronic hardware monitoring component of the motherboard and BIOS. You may want to have your computer checked or serviced.

 

Your Password Must Be at Least 18770 Characters and Cannot Repeat Any of Your Previous 30689 Passwords

http://support.microsoft.com/?kbid=276304

 

SYMPTOMS

If you log on to an MIT realm, press CTRL+ALT+DELETE, click Change Password, type your existing MIT password, and then type a new, simple password that does not pass the dictionary check in Kadmind, you may receive the following error message:

Your password must be at least 18770 characters and cannot repeat any of your previous 30689 passwords. Please type a different password. Type a password that meets these requirements in both text boxes.

 

Note that the number of required characters changes from 17,145 to 18,770 with the installation of SP1.

 

NOTE: This is not a common case; it occurs only when you configure Windows 2000 to authenticate against an MIT Kerberos domain.

 

How to Work with More Than 64,000 Children Per Parent

http://support.microsoft.com/?kbid=303969

 

SUMMARY

SQL Server 2000 Books Online specifies that the maximum number of child members a parent can have is 64,000. What does this mean? What can you do if you have a dimension that violates this rule? What if a parent has more than 64,000 children?

 

 

Posted by dhite | with no comments
Filed under:

Funny Website Names

 

‘Who represents‘where you can find the name of the agent that represents a celebrity

www.whorepresents.com

 

Experts Exchange, a knowledge base where programmers can exchange advice.

www.expertsexchange.com

 

Looking for a pen? Look no further than Pen Island at

www.penisland.net

 

Need a therapist? Try Therapist Finder at

www.therapistfinder.com

 

An Italian Power Generator company

www.powergenitalia.com

 

The Mole Station Native Nursery in New South Wales

www.molestationnursery.com

 

Essentiasl tools for pcAnywhere

www.ipanywhere.com

 

The First Cumming Methodist Church

www.cummingfirst.com

 

Art designers

www.speedofart.com

 

Lake Tahoe brochure website at

www.gotahoe.com

 

 

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

Vbs Script To Delete An Individual Machine From The SMS Database

 

This Vbs script will allow you to enter a machine name and delete it from the SMS database. It will prompt you for the Site Server Name, Site Code and Machine name. It will then attempt to determine the ResourceId for the machine and if it is found delete the machine from the SMS database.

 

To remove a list of machines from the SMS database see my previous post:

 

Delete Machines From SMS And Send The Results To Excel

http://myitforum.com/cs2/blogs/dhite/archive/2006/09/17/Delete-Machines-From-SMS-And-Send-The-Results-To-Excel.aspx

 

Vbs Script:

 

strServer = InputBox("Enter Site Server Name")

strSiteCode = InputBox("Enter Site Code")

strComputer = InputBox("Enter Machine Name To Delete")

 

Set locator = CreateObject( "WbemScripting.SWbemLocator" )

Set WbemServices1 = locator.ConnectServer( strServer,"root\SMS\site_" & strSiteCode)

 

ResID = getResID(strComputer, WbemServices1)

If ResID = Empty Then

MsgBox "Unable To Determine The ResourceId For " & strComputer & " Exiting Application"

Wscript.Quit

Else 

MsgBox "The ResourceId For " & strComputer & " On " & strServer & " Is " & ResID

End If

 

Set sResource = WbemServices1.Get("SMS_R_System='" & ResID & "'")

sResource.Delete_

 

If Err = 0 Then

MsgBox strComputer & " Has Been Removed From " & strSiteCode

Else

MsgBox "Unable To Locate " & strComputer & " On " & strServer

End If  

 

Set sResource = Nothing

 

Function GetResID(strComputer, oWbem)

strQry = "Select ResourceID from SMS_R_System where Name=" & "'" & strComputer & "'"

Set objEnumerator = oWbem.ExecQuery(strQry)

If Err <> 0 Then

GetResID = 0

Exit Function

End If

 

For Each objInstance in objEnumerator

For Each oProp in objInstance.Properties_

GetResID = oProp.Value

Next

Next

 

Set objEnumerator = Nothing

End Function

 

Posted by dhite | with no comments
Filed under:

List SMS Sites And Their Appropriate Client Counts To Excel

 

Use the following Vbs script to count the number of client machines for your site code using the _Res_Coll_Sms00001 collection IsClient attribute.

 

Note: Change the “ServerName” in line to your server name and change “SMS_XXX” to your three letter site code.

 

Vbs Script:

 

Const adOpenStatic = 3

Const adLockOptimistic = 3

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

objExcel.Cells(1, 1).Value = "Client Count"

objExcel.Cells(1, 2).Value = "Site Code"

objExcel.Cells(1, 3).Value = "Report Date"

 

Set objConnection = CreateObject("ADODB.Connection")

Set objRecordSet = CreateObject("ADODB.Recordset")

 

 

objConnection.Open _

"Provider = SQLOLEDB; Data Source = ServerName;" & _

"Initial Catalog = SMS_XXX;" & _

"Integrated Security = SSPI;"

 

objRecordSet.Open "Select * From _Res_Coll_Sms00001 Where IsClient = 1 and SiteCode = 'XXX'",_

objConnection, adOpenStatic, adLockOptimistic

 

Do Until objRecordset.EOF

objExcel.Cells(intRow, 1).Value = objRecordSet.RecordCount

objRecordset.MoveNext

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

objRecordset.MoveNext

Loop

objExcel.Cells(intRow, 3).Value = Now

intRow = intRow + 1

 

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 objConnection = Nothing

Set objRecordSet = Nothing

Set objExcel = Nothing

 

 

Posted by dhite | with no comments
Filed under:

To All Of Those Baby Boomers Who Survived

First, we survived being born to mothers who smoked and/or drank while they were pregnant. They took aspirin, ate blue cheese dressing, tuna from a can, and didn't get tested for diabetes.

 

Then after that trauma, we were put to sleep on our tummies in baby cribs covered with bright colored lead-based paints.

 

We had no childproof lids on medicine bottles, doors or cabinets and when we rode our bikes, we had no helmets, not to mention, the risks we took hitchhiking as infants & children, we would ride in cars with no car seats, booster seats, seat belts or air bags.

 

Riding in the back of a pick up on a warm day was always a special treat.

 

We drank water from the garden hose and NOT from a bottle.

 

We shared one soft drink with four friends, from one bottle and no one actually died from this.

 

We ate cupcakes, white bread and real butter and drank koolade made with sugar, but we weren't overweight because we were always outside playing!

 

We would leave home in the morning and play all day, as long as we were back when the streetlights came on.

 

No one was able to reach us all day. And we were OK.

 

We would spend hours building our go-carts out of scraps and then ride down the hill, only to find out we forgot the brakes. After running into the bushes a few times, we learned to solve the problem.

 

We did not have Play stations, Nintendo's, X-boxes, no video games at all, no 150 channels on cable, no video movies or DVD's, no surround-sound or CD's, no cell phones and no personal computer or Internet or chat rooms we had friends and we went outside and found them!

 

We fell out of trees, got cut, broke bones and teeth and there were no lawsuits from these accidents.

 

We ate worms and mud pies made from dirt, and the worms did not live in us forever.

 

We were given BB guns for our 10th birthdays, made up games with sticks and tennis balls and, although we were told it would happen, we did not put out very many eyes.

 

We rode bikes or walked to a friend's house and knocked on the door or rang the bell, or just walked in and talked to them!

 

Little League had tryouts and not everyone made the team. Those who didn't had to learn to deal with disappointment.

 

The idea of a parent bailing us out if we broke the law was unheard of. They actually sided with the law!

 

We had freedom, failure, success and responsibility, and we learned.

 

These generations have produced some of the best risk-takers, problem solvers and inventors ever! The past 50 years have been an explosion of innovation and new ideas.

 

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

Halloween Facts

About 99% of pumpkins marketed domestically are used as Jack O'Lanterns at Halloween.

 

Following the Roman conquest in 43 AD, the celebration of Samhain began to incorporate elements of Pomona, the Roman celebration of the harvest. Foods served during this feast included apples and nuts.

 

Halloween is a relatively new holiday in the United States with the first major celebrations taking place in Anoka, Minnesota in 1921. This was followed by New York in 1923 and Los Angeles in 1925.

 

Halloween also is recognized as the 3rd biggest party day after New Year's and Super Bowl Sunday.

 

Halloween is one of the oldest celebrations in the world, dating back over 2000 years to the time of the Celts who lived in Britain and northern France. It has its roots in the feast of Samhain, which took place on 31 October each year to honor the dead.

 

In the United States, 86% of Americans decorate their homes for Halloween.

 

Legendary magician Harry Houdini died in Detroit from a ruptured appendix on Halloween in 1926.

 

More than 93 percent of children go trick-or-treating each year.

 

People have believed for centuries that light keeps away ghosts and ghouls. Making a pumpkin lantern with a candle inside may keep you safe from all the spooky spirits flying around on Halloween.

 

The Americans also began the use of pumpkins for lanterns, as they were more freely available than turnips in the US.

 

The carving of jack-o'-lanterns originated from the tradition of carving the faces of lost souls into hollowed out pumpkins and turnips. A candle was placed inside the carvings making the faces glow. The Halloween lanterns were placed on doorsteps to ward off evil spirits.

 

The original Halloween film directed by John Carpenter in 1978 cost just $320,000 to make. It ended up making over $50m worldwide.

 

The record for the fastest pumpkin carver in the world is Jerry Ayers of Baltimore, Ohio. He carved a pumpkin in just 37 seconds!

 

The US was also responsible for the practice of ‘Trick or Treating’ which is said to represent the fairies who went begging door-to-door on Samhain. Those who gave food were rewarded whilst those who refused to help would be in for a hard winter.

 

The world's fastest time to carve a face into a pumpkin is 54.72 seconds, by Stephen Clarke (USA), on October 23, 2001 (source: Guinness World Records)

 

There were estimated 36.8 million potential "trick-or-treaters" ages 5-13.

 

To further appease wandering spirits, large bonfires were lit and Celtic priests would offer sacrifices of crops and animals make charms and cast spells.

 

Trick-or-treating is thought to have its origins in a European custom called souling where people would beg for "soul cakes."

 

Don Hite (Yes that’s me!) began working for IBM on October 31st.

 

More Resources:

 

History Of Halloween From Wikipedia

http://en.wikipedia.org/wiki/Halloween

 

History and folklore of Halloween

http://www.answers.com/topic/history-and-folklore-of-halloween

 

 

Posted by dhite | 1 comment(s)
Filed under:
More Posts Next page »