VBS Script To Get All Users Information And Last Login Information And Send To Excel

 

This VBS script will allow you to enter an Active Directory (AD) domain name and will return the following information to an Excel spreadsheet: Login Name, First Name, Last Name, Full Name, Description, Last Login and Password Last Changed information.

 

VBS Script:

 

strDomain = InputBox ("Enter Domain Name")

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

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

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

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

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

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

objExcel.Cells(1, 6).Value = "Last Login"

objExcel.Cells(1, 7).Value = "Password Last Changed"

 

On Error Resume Next

Const ADS_SCOPE_SUBTREE = 2

 

Set objConnection = CreateObject("ADODB.Connection")

Set objCommand =   CreateObject("ADODB.Command")

objConnection.Provider = "ADsDSOObject"

objConnection.Open "Active Directory Provider"

Set objCommand.ActiveConnection = objConnection

 

objCommand.Properties("Page Size") = 1000

objCommand.Properties("Searchscope") = ADS_SCOPE_SUBTREE

 

objCommand.CommandText = _

"Select ADsPath From 'LDAP://dc=" & strDomain & ",dc=com'" & _

" Where objectCategory='User' And userPrincipalName = '*'"

Set objRecordSet = objCommand.Execute

objRecordSet.MoveFirst

 

Do Until objRecordSet.EOF

strPath = objRecordSet.Fields("ADsPath").Value

Set objUser = GetObject(strPath)

objExcel.Cells(intRow, 1).Value = objUser.sAMAccountName

objExcel.Cells(intRow, 2).Value = objUser.FirstName

objExcel.Cells(intRow, 3).Value = objUser.LastName

objExcel.Cells(intRow, 4).Value = objUser.FullName

objExcel.Cells(intRow, 5).Value = objUser.Description

objExcel.Cells(intRow, 6).Value = objUser.LastLogin

objExcel.Cells(intRow, 7).Value = objUser.PasswordLastChanged

objRecordSet.MoveNext

intRow = intRow + 1

Loop

 

objExcel.Range("A1:G1").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("A2")

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

 

MsgBox "Done"

 

 

 

Posted by dhite | with no comments
Filed under:

VBS Scripts To Change The Text For A Local Machines My Computer Icon

 

Here you will find several VBS scripts that will allow you to change the Text for the My Computer icon on your desktop.

 

The scripts will allow you to change the text from “My Computer” to the Computer Name, User Name or the Computer Name and User Name. There is also a script that will allow you to hard code the text as well as one that will prompt you for the text to change the caption to via an input dialog box.

 

Computer Name

Const MY_COMPUTER = &H11&

 

Set objNetwork = CreateObject("Wscript.Network")

strText = UCase(objNetwork.ComputerName)

 

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace(MY_COMPUTER)

Set objFolderItem = objFolder.Self

 

objFolderItem.Name = strText

 

User Name

Const MY_COMPUTER = &H11&

 

Set objNetwork = CreateObject("Wscript.Network")

strText = UCase(objNetwork.UserName)

 

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace(MY_COMPUTER)

Set objFolderItem = objFolder.Self

 

objFolderItem.Name = strText

 

Computer Name And User Name

Const MY_COMPUTER = &H11&

 

Set objNetwork = CreateObject("Wscript.Network")

strText = UCase(objNetwork.ComputerName) & vbCrLf & UCase(objNetwork.UserName)

 

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace(MY_COMPUTER)

Set objFolderItem = objFolder.Self

 

objFolderItem.Name = strText

 

Hard Coded Text

Const MY_COMPUTER = &H11&

 

Set objNetwork = CreateObject("Wscript.Network")

strText = "Don Hite"

 

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace(MY_COMPUTER)

Set objFolderItem = objFolder.Self

 

objFolderItem.Name = strText

 

Prompts For Text

Const MY_COMPUTER = &H11&

 

Set objNetwork = CreateObject("Wscript.Network")

strText = InputBox ("Enter Text For My Computer Icon")

 

Set objShell = CreateObject("Shell.Application")

Set objFolder = objShell.Namespace(MY_COMPUTER)

Set objFolderItem = objFolder.Self

 

objFolderItem.Name = strText

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Export SMS WQL User Resource Queries 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 User queries on that server and read their corresponding WQL Queries. It will then write them to a Microsoft Word document that you can save for future reference.

 

VBS Script:

 

strComputer = InputBox ("Enter Site Server Name")

strSiteCode = InputBox("Enter Site Code")

 

Set objWord = CreateObject("Word.Application")

objWord.Visible = True

 

Const wdAlignParagraphCenter = 1

Const wdAlignParagraphLeft = 0 

 

Const wdColorGreen = 32768

Const wdColorBlue = 16711680

Const wdColorBlack = 0

Const wdColorGray = 15132390

 

Set objDoc = objWord.Documents.Add()

Set objSelection = objWord.Selection

 

objSelection.Font.Bold = True

objSelection.Font.Color = wdColorGreen

objSelection.ParagraphFormat.Alignment = wdAlignParagraphCenter

objSelection.TypeText "SMS WQL User Resource Queries For " & UCase(strComputer)

objSelection.Font.Bold = False

objSelection.TypeParagraph()

objSelection.TypeText "Report Created: " & Date

objSelection.TypeParagraph()

objSelection.TypeParagraph()

objSelection.ParagraphFormat.Alignment = wdAlignParagraphLeft

 

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

Set colItems = objWMIService.ExecQuery("Select * from SMS_Query Where TargetClassName = 'SMS_R_User'")

For Each objItem in colItems

 

objSelection.ParagraphFormat.Alignment = wdAlignParagraphCenter

objSelection.Font.Color = wdColorBlue

objSelection.Font.Bold = True

objSelection.ParagraphFormat.Shading.BackgroundPatternColor = wdColorGray

objSelection.TypeText objItem.Name

objSelection.TypeParagraph()

objSelection.TypeParagraph()

 

objSelection.ParagraphFormat.Alignment = wdAlignParagraphLeft

objSelection.Font.Color = wdColorBlack

objSelection.Font.Bold = False

objSelection.TypeText objItem.Expression

objSelection.TypeParagraph()

objSelection.TypeParagraph()

Next

 

objSelection.ParagraphFormat.Alignment = wdAlignParagraphCenter

objSelection.Font.Color = wdColorGreen

objSelection.TypeText "Created by Don Hite For myITforum.Com"

objSelection.TypeParagraph()

 

VBS Script To Export SMS Queries To Microsoft Word

http://myitforum.com/cs2/blogs/dhite/archive/2008/02/24/vbs-script-to-export-sms-queries-to-microsoft-word.aspx

 

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Export SMS UnSpecified Queries 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 Unspecified queries on that server and read their corresponding WQL Queries. It will then write them to a Microsoft Word document that you can save for future reference.

 

VBS Script:

 

strComputer = InputBox ("Enter Site Server Name")

strSiteCode = InputBox("Enter Site Code")

 

Set objWord = CreateObject("Word.Application")

objWord.Visible = True

 

Const wdAlignParagraphCenter = 1

Const wdAlignParagraphLeft = 0 

 

Const wdColorGreen = 32768

Const wdColorBlue = 16711680

Const wdColorBlack = 0

Const wdColorGray = 15132390

 

Set objDoc = objWord.Documents.Add()

Set objSelection = objWord.Selection

 

objSelection.Font.Bold = True

objSelection.Font.Color = wdColorGreen

objSelection.ParagraphFormat.Alignment = wdAlignParagraphCenter

objSelection.TypeText "SMS WQL User Group Resource Queries For " & UCase(strComputer)

objSelection.Font.Bold = False

objSelection.TypeParagraph()

objSelection.TypeText "Report Created: " & Date

objSelection.TypeParagraph()

objSelection.TypeParagraph()

objSelection.ParagraphFormat.Alignment = wdAlignParagraphLeft

 

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

Set colItems = objWMIService.ExecQuery("Select * from SMS_Query Where TargetClassName = ''")

For Each objItem in colItems

 

objSelection.ParagraphFormat.Alignment = wdAlignParagraphCenter

objSelection.Font.Color = wdColorBlue

objSelection.Font.Bold = True

objSelection.ParagraphFormat.Shading.BackgroundPatternColor = wdColorGray

objSelection.TypeText objItem.Name

objSelection.TypeParagraph()

objSelection.TypeParagraph()

 

objSelection.ParagraphFormat.Alignment = wdAlignParagraphLeft

objSelection.Font.Color = wdColorBlack

objSelection.Font.Bold = False

objSelection.TypeText objItem.Expression

objSelection.TypeParagraph()

objSelection.TypeParagraph()

Next

 

objSelection.ParagraphFormat.Alignment = wdAlignParagraphCenter

objSelection.Font.Color = wdColorGreen

objSelection.TypeText "Created by Don Hite For myITforum.Com"

objSelection.TypeParagraph()

 

VBS Script To Export SMS Queries To Microsoft Word

http://myitforum.com/cs2/blogs/dhite/archive/2008/02/24/vbs-script-to-export-sms-queries-to-microsoft-word.aspx

 

 

 

Posted by dhite | with no comments
Filed under:

SQL Query To List Machines With IIS , FTP Or Telnet Installed

 

This SQL query will list all of the machines that have the World Wide Web Publishing Service, the FTP Publishing Service or the Telnet server services installed by their Service name.

 

SQL Query:

 

Select

SD.Name0 'Machine Name',

SD.Operating_System_Name_and0 NOS,

SS.Name0 'Service Name',

SS.DisplayName0 'Display Name',

SS.StartMode0 'Start Type',

SS.Started0 Started,

SS.State0 State,

SS.Status0 Status

 

From System_DISC SD

Join Services_DATA SS

on SS.MachineID = SD.ItemKey

 

Where SS.Name0 In ('W3SVC', 'MsFtpSvc', 'TlntSvr')

Order By 'Machine Name'

 

 

 

Posted by dhite | with no comments
Filed under:

SQL Query To Count The Number Of Client Machines With McAfee Virus Scan Installed

 

This SQL query was written as a request from a reader wanting to know how to count the number of machines that have McAfee VirusScan Enterprise installed by using the Add And Remove Programs applet.

 

SQL Query:

 

Select

Count(SD.Name0) Counts,

PF.DisplayName0,

PF.Version0

 

From v_Add_Remove_Programs PF

Join v_R_System SD on PF.ResourceID = SD.ResourceID

Where PF.DisplayName0 = 'McAfee VirusScan Enterprise'

 

Group By PF.DisplayName0, PF.Version0

Order By Counts, PF.Version0

 

To see the machine names rather than the counts use this query:

 

Select

SD.Name0,

PF.DisplayName0,

PF.Version0

 

From v_Add_Remove_Programs PF

Join v_R_System SD on PF.ResourceID = SD.ResourceID

Where PF.DisplayName0 = 'McAfee VirusScan Enterprise'

 

Group By SD.Name0, PF.DisplayName0, PF.Version0

Order By SD.Name0

 

 

 

Posted by dhite | with no comments
Filed under:

Over A Barrel

 

To be over a barrel means that one is in a helpless circumstance and does not have any control over the situation. Reportedly this expression has its origins in the fact that during the 1800’s when someone was subjected to corporal punishment by flogging they were bent over a barrel and their punishment was delivered. There is also a less credible one that states that drowning victims were rolled over onto a barrel in order to clear water from their lungs.

 

 

 

Posted by dhite | with no comments
Filed under:

How To Disable The Windows Vista Splash Screen

 

Here you will find information on how to remove or disable the Windows Vista splash screen.

 

1. Open MsConfig from the Start Search or from a command prompt (CMD).

 

2. Select the System Configuration “Boot” tab and place a check in the box for “No GUI Boot”

 

3. Then reboot your workstation.

 

Additional Boot Option Information

 

Minimal

Non Network boot into the Windows user interface in safe mode and runs only critical system services.

 

Alternate Shell

Non Network boot to a command prompt and runs only critical system services.

 

Active Directory Repair

Same as the Minimal boot with Active Directory enabled.

 

Network

Same as the Minimal boot with the network enabled.

 

No GUI Boot

No Windows splash screen is displayed when booting.

 

Boot Log

The boot process information is stored and written to file.

 

Base Video

Boots to Windows user interface in VGA mode.

 

OS Boot Information

Displays each driver as it is loaded in the boot process.

 

 

Posted by dhite | with no comments
Filed under:

SQL Server 2008 RC 0 Has Been Released

 

Microsoft SQL Server 2008 Release Candidate (RC) 0 has been released and is available for download to TechNet Plus and MSDN subscribers.

 

TechNet Plus

http://technet.microsoft.com/en-us/subscriptions/downloads/details/default.aspx?pm=p:334

 

MSDN

http://msdn.microsoft.com/en-us/subscriptions/downloads/details/default.aspx?pm=pid:334

 

 

 

Posted by dhite | with no comments

System Center Configuration Manager 2007 Product Feature Quizzes

 

Download System Center Configuration Manager 2007 Product Feature PowerPoint 2007 (PPS) Quizzes to review and test your Configuration Manager knowledge.

 

Thanks to Mike Reavis for showing these jewels at the May KCRSMUG meeting.

 

The System Center Configuration Manager 2007 User Assistance team has created a set of quizzes to help you assess your understanding of the dependencies and requirements for key features of Configuration Manager. These quizzes are intended to raise your level of awareness of the some of the nuances of these features before you configure and use them. They can also be used to help train other Configuration Manager administrators within your organization. Each quiz consists of 10 questions that can be answered Yes or No. Regardless of your answer, the quiz will display the correct information, and include one or more links to the corresponding related content located in the Configuration Manager 2007 Documentation Library located on the Configuration Manager TechCenter. We are testing the usefulness of this format, and ask for your feedback on the format and the content contained in each quiz.

 

Please send feedback to SMSDOCS@Microsoft.com.

 

PPS Downloads:

http://www.microsoft.com/downloads/details.aspx?FamilyID=b9fb478a-ec98-47f2-b31e-57443a8ae88f&DisplayLang=en

 

SCCM Quizes

http://myitforum.com/cs2/blogs/kcrsmug

 

 

 

Posted by dhite | with no comments
Filed under:

George Carlin Quotes

 

George Denis Patrick Carlin (1937 – 2008) American comedian and author

 

  • "I am" is reportedly the shortest sentence in the English language. Could it be that "I do" is the longest sentence?
  • As a matter of principle, I never attend the first annual anything.
  • Atheism is a non-prophet organization.
  • Don't sweat the petty things and don't pet the sweaty things.
  • Electricity is really just organized lightning.
  • Have you ever noticed that anybody driving slower than you is an idiot, and anyone going faster than you is a maniac?
  • I don't like to think of laws as rules you have to follow, but more as suggestions.
  • I recently went to a new doctor and noticed he was located in something called the Professional Building. I felt better right away.
  • I went to a bookstore and asked the saleswoman, "Where's the self-help section?" She said if she told me, it would defeat the purpose.
  • If it's true that our species is alone in the universe, then I'd have to say the universe aimed rather low and settled for very little.
  • If lawyers are disbarred and clergymen defrocked, doesn't it follow that electricians can be delighted, musicians denoted?
  • I'm always relieved when someone is delivering a eulogy and I realize I'm listening to it.
  • Isn't it a bit unnerving that doctors call what they do "practice?"
  • It's never just a game when you're winning.
  • Just cause you got the monkey off your back doesn't mean the circus has left town.
  • One tequila, two tequila, three tequila, floor.
  • Some national parks have long waiting lists for camping reservations. When you have to wait a year to sleep next to a tree, something is wrong. 
  • The IQ and the life expectancy of the average American recently passed each other going in opposite directions.
  • The main reason Santa is so jolly is because he knows where all the bad girls live.
  • The other night I ate at a real nice family restaurant. Every table had an argument going.
  • The reason I talk to myself is that I'm the only one whose answers I accept.
  • Weather forecast for tonight: dark. Continued dark overnight, with widely scattered light by morning.
  • What does it mean to pre-board? Do you get on before you get on?
  • When someone is impatient and says, "I haven't got all day," I always wonder, How can that be? How can you not have all day?
  • Why do croutons come in airtight packages? It's just stale bread to begin with.
  • You know an odd feeling? Sitting on the toilet eating a chocolate candy bar.

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Send Add And Remove Applications For A remote Machine To Excel

 

This VBS script will take a remote machine name from an input dialog box and write the following information to an excel spreadsheet for each listed item in the remote machines add and remove applications program group.

 

Machine Name

Display Name

Product ID

Publisher

Version

 

VBS Script:

 

strComputer = InputBox ("Enter Machine Name")

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

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

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

objExcel.Cells(1, 3).Value = "Product ID"

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

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

 

 

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

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

For Each objItem in colItems

 

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

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

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

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

objExcel.Cells(intRow, 5).Value = objItem.Version

 

intRow = intRow + 1

Next

 

objExcel.Range("A1:E1").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 | 1 comment(s)
Filed under:

VBS Script To Ping A Remote Machine Until The Command Window Is Closed

 

Here you will find a VBS script that will allow you to ping a remote machine continuously (Ping –t) until you close the command window. The script can be used to monitor the shutdown or reboot process for a server or workstation.

 

Ping Script:

 

strComputer = InputBox("Enter Machine Name")

Set objShell = CreateObject("Wscript.Shell")

 

strCommand = "%Comspec% /k Ping -t " & strComputer

objShell.Run strCommand

 

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Open A Web Page

 

This simple little VBS script can be used as a desktop link or shortcut to open your favorite web page.

 

VBS Script:

 

strURL = "http://myitforum.com"

Set objShell = CreateObject("Wscript.Shell")

objShell.Run(strURL)

 

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Issue The Nslookup Command Against A Remote Machine

 

Here you will find a VBS script that will allow you to issue the NsLookUp command against a remote machine.

 

NsLookUp Script:

 

strComputer = InputBox("Enter Machine Name")

Set objShell = CreateObject("Wscript.Shell")

 

strCommand = "%Comspec% /k NsLookUp " & strComputer

objShell.Run strCommand