October 2008 - Posts

VBS Script To Send Network Adapter Information To Excel From A List Of Machines

 

This VBS script will read a text file called MachineList.Txt and will write the Machine name, Network adapter name and Manufacturer name to an Excel spreadsheet.

 

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 = "Network Adapter"

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

 

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_NetworkAdapter Where NetConnectionStatus = '2'")

For Each objItem in colItems

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

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

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

intRow = intRow + 1

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

loop

 

Wscript.Echo "Done"

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Send A Remote Machines Logical Disk Information To Excel

 

This VBS Script will take a local or remote machine name from an input dialog box and will send the machine name, drive letter and disk type to an Excel spreadsheet.

 

VBS Script:

 

strComputer = InputBox("Enter Server Name")

 

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 = "Device ID"

objExcel.Cells(1, 3).Value = "Drive Type"

 

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

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

   

For Each objItem in colItems

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

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

Select Case objItem.DriveType

Case 0 DriveType = "Unknown"

Case 1 DriveType = "No Root Directory"

Case 2 DriveType = "Removable Disk"

Case 3 DriveType = "Local Disk Drive"

Case 4 DriveType = "Network Connection"

Case 5 DriveType = "CD-ROM Disc"

Case 6 DriveType = "RAM Drive"

Case Else DriveType = ""

End Select

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

intRow = intRow + 1

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

 

MsgBox "Done"

 

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To List Folders And Subfolders Files And Send To Excel

 

This VBS script will allow you to hard code a directory folder name and when executed will send all of the files in the root directory folder and all the sub folders to an excel spreadsheet.

 

VBS Script:

 

objStartFolder = "C:\MyFiles"

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

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

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

 

Set objFSO = CreateObject("Scripting.FileSystemObject")

Set objFolder = objFSO.GetFolder(objStartFolder)

 

Set colFiles = objFolder.Files

For Each objFile in colFiles

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

objExcel.Cells(intRow, 2).Value = objFile.Name

intRow = intRow + 1

Next

 

ShowSubfolders objFSO.GetFolder(objStartFolder)

 

Sub ShowSubFolders(Folder)

For Each Subfolder in Folder.SubFolders

objExcel.Cells(intRow, 1).Value = Subfolder.Path

 

Set objFolder = objFSO.GetFolder(Subfolder.Path)

Set colFiles = objFolder.Files

For Each objFile in colFiles

objExcel.Cells(intRow, 2).Value = objFile.Name

intRow = intRow + 1

Next

 

ShowSubFolders Subfolder

Next

End Sub

 

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:

SQL Query To Find All IBM And Lenovo Machines

 

This SQL Query will provide you with a list of all of the IBM and Lenovo machines.

 

SQL Query:

 

Select

SD.Name0,

CS.Manufacturer0

 

From v_R_System SD

Join  v_GS_Computer_System CS On SD.ResourceId = CS.ResourceId

 

Where CS.Manufacturer0 = 'IBM'

Or CS.Manufacturer0 = 'Lenovo'

 

Order By CS.Manufacturer0, SD.Name0

 

 

Posted by dhite | with no comments
Filed under:

SQL Queries To Retrieve The Views For A Specified SQL Database

 

Provided here you will find two SQL queries to allow you to list all of the Views from a specified SQL Database.

 

The first query uses the Tables Schema and the second one uses the Views Schema.

 

SQL Query: Tables Schema

 

Select

Table_Name

From Information_Schema.Tables

Where Table_Type = 'View'

Order By Table_Name

 

SQL Query: Views Schema

 

Select

Table_Name

From Information_Schema.Views

Order By Table_Name

 

 

Posted by dhite | with no comments
Filed under:

Eves Dropping

 

When we say that someone was or are eves dropping it is meant to infer that they are listening in on a private conversation when they should not be.

 

This can be traced back to the age before the invention of the rain gutter where they used eves to carry rainwater away from their homes and other buildings. Eves were an extension of the roof and if someone was standing under the eves they could hear conversations in the home through an open window or through thin walls before insulation was invented. If they were in fact listening to the conversations inside the home they were eves dropping.

 

 

Posted by dhite | with no comments
Filed under:

Wikimedia Commons

 

The Wikimedia Commons site is a Shared media repository site where you can grab pictures and images for your desktop wallpaper or photo screensaver royalty free.

 

Wikimedia Commons

http://commons.wikimedia.org

 

 

 

Posted by dhite | with no comments
Filed under: ,

HTA Script To List Roles For A Specified Site Server

 

This HTA script will take a site server name and site code and list all of the available site system roles for the server and send the results to the active window.

 

HTA Script:

 

<Html>

<Head>

<Title>HTA Script</Title>

<Style>

Body {Background-Color: CornSilk}

</Style>

 

<HTA:Application

Caption = Yes

Border = Thick

ShowInTaskBar = No

MaximizeButton = Yes

MinimizeButton = Yes>

 

<script Language = VBScript>

Sub WindowsLoad

strHTML = "<table border='1' style='border-collapse: collapse' bordercolor='SaddleBrown' id='Table1' >"

strHTML = strHTML & "<tr>"

strHTML = strHTML & "<td width='10%' bgcolor = 'SeaShell'><font color = 'Blue'><b>Site Server Roles</td>"

strHTML = strHTML & "</tr>"

 

strComputer = SiteServer.Value

strSiteCode = SiteCode.Value

 

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

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

For Each objItem in colItems

 

strHTML = strHTML & "<tr>"

Window.Document.Title = "Site Server Roles For " & UCase(SiteServer.Value) & " (" & UCase(SiteCode.Value) & ")"

strHTML = strHTML & "<td width='1%'>" & objItem.RoleName & "</td>"

Next

strHTML = strHTML & "</tr>"

strHTML = strHTML & "</table>"

DataArea.InnerHTML = strHTML

End Sub

 

</script><Body>

<p><h3 align = center><font color='Orange'>Please Visit myITforum.Com</font></h3>

<div></div>

Site Server: <Input Type = "Text" Name = "SiteServer">

Site Code: <Input Type = "Text" Name = "SiteCode">

<Input Type = "Button" Value = "Run Script" Name = "Run_Button" onClick = "WindowsLoad"><P>

<Span Id = "DataArea"></Span></Body><Div Align = "Center">

<P><A Href="http://myitforum.com/cs2/blogs/dhite">Created For myITforum By Don Hite</A>

 

 

Posted by dhite | with no comments
Filed under:

ConfigMgr Branch DP Add Tool

 

BDPAdd is a tool that will bulk add protected branch distribution points to a ConfigMgr 2007 (SCCM) hierarchy. There is currently not a way, in the ConfigMgr console, to add multiple protected Branch distribution points at once. This tools attempts to address that problem.

 

Running the tool

 

BDPAdd.exe /s {central site server} /file {excel file} /log {path}

 

/s Central Site Server name.

/file Path to Excel files.

/log Log file path.

 

The input for this tool is an Excel 2003 spreadsheet and there are some requirements for the format of this spreadsheet. Review the example spreadsheet, bdpexample.xls, attached. Any deviation from this will either produce errors or unexpected results.

 

All output from this tool is written to the log file only. (The Trace utility from the ConfigMgr toolkit can be used to view the log) 

 

BDPAdd 1.0 http://www.codeplex.com/bdpadd/Release/ProjectReleases.aspx?ReleaseId=14111

 

Additional Information

http://www.codeplex.com/bdpadd

 

 

 

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

By Request VBS Script To Replace A WMI String Result Set With A Substituted String

 

This VBS script was written as an example of how to replace the results from a WMI string results set to remove unwanted characters.

 

The BootDirectory value of \WINDOWS has the \ removed or trimmed from it and the Caption has the \Device\Harddisk0\Partition removed.

 

VBS Script:

 

strComputer = "LocalHost"

 

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

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

For Each objItem in colItems

 

strBootDirectory = Replace(objItem.BootDirectory, "\", "")

MsgBox "Boot Directory: " & strBootDirectory

 

strDisk = Replace(objItem.Caption, "\Device\Harddisk0\Partition", "")

MsgBox "Partition: " & strDisk

 

Next

 

 

Posted by dhite | with no comments
Filed under:

Celebrity Hairstyles If They Were Women

 

What kind of hairstyles would Leonardo Decaprio, Harry Potter, Jim Carrey, Bill Gates, Bruce Willis, George Clooney, Jay Leno, George Foreman, Ashton Kutcher, Ben Affleck, Sean Penn, Mat Damon, Orlando Bloom and Nicolas Cage have if they were women?

 

Celebrity Hairstyles - If They Were Women

http://world-haircuts.blogspot.com/2008/04/celebrity-hairstyles-if-they-were-women.html

 

 

 

Posted by dhite | with no comments
Filed under:

New Employee Manual

 

Welcome aboard! You are one of our most valued new employees. Enclosed please find some helpful guidelines to company policy.

 

Overtime

The Company has an optional overtime policy - you have the option of working forty hours of overtime or eighty hours of overtime.

 

Promotion

The Company rewards hard work and devotion. We like to think that if you work hard and devote enough time and energy to the company, you will be rewarded by being allowed to train the CEO's son when he is promoted to Vice President over you.

 

Stock Options

You may buy shares in the company when it goes public. So named because you'll be working in the stock room at Wal-Mart when the company goes belly-up due to your incompetence.

 

401k

This is how much money you'll lose under your "Stock Option" plan.

 

Hellth Plan

No, that isn't a misprint; you now belong to an H.M.O. That stands for "Hell's Medical Organization." It was organized by some of Hell's finest minds: Hitler, Genghis Khan, and Josef Stalin worked night and day to create a 162-page manual documenting the exact terms of your coverage, but it all boils down to three points:

 

1. You belong to the HMO. We mean that literally - as of now, the HMO owns you. To insure that you don't forget your subscriber number, we will tattoo it to your forehead.

 

2. You have been assigned a primary care physician. You will not be told your physician's name. You may never see your physician. Your physician is imaginary. If you see any doctor without express written permission of your imaginary primary care physician, you will be forced to pay full price, plus eat your weight in lard.

 

3, You are not covered under this plan.

 

Termination

All employees will be given two weeks notice upon being fired. We like to feel that this gives an employee a "grace period" to steal all of the office supplies that he or she may have forgotten to take during his or her period of employment.

 

Complaints

May be made anonymously in the box marked "Complaints" in the employee break room. All complaints will be reviewed, processed, and fed to an angry Rottweiler named Frankie.

 

Thanks Chad W.

 

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Send A Remote Machines Service Information To A Web Page

 

This VBS script will allow you to enter a remote machine name into an input dialog box and will in turn list the services on that machine with their current state marked Green (Running) or Red (Stopped) as appropriate to a web page.

 

VBS Script:

 

strComputer = InputBox ("Enter Machine Name")

 

Set objExplorer = WScript.CreateObject("InternetExplorer.Application")

objExplorer.Navigate "About:Blank"

objExplorer.Document.Title = "Created By Don Hite For myITforum.Com"

objExplorer.ToolBar = 0

objExplorer.StatusBar = 0

objExplorer.Visible = 1

 

strHTML = "<table border='1' style='border-collapse: collapse' bordercolor='SaddleBrown' id='Table1' >"

strHTML = strHTML & "<tr>"

strHTML = strHTML & "<td width='10%' bgcolor = 'SeaShell'><font color = 'Blue'><b>Name</td>"

strHTML = strHTML & "<td width='10%' bgcolor = 'SeaShell'><font color = 'Blue'><b>Display Name</td>"

strHTML = strHTML & "<td width='10%' bgcolor = 'SeaShell'><font color = 'Blue'><b>Start Mode</td>"

strHTML = strHTML & "<td width='10%' bgcolor = 'SeaShell'><font color = 'Blue'><b>State</td>"

strHTML = strHTML & "</tr>"

 

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

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

For Each objItem in colItems

 

strHTML = strHTML & "<tr>"

strHTML = strHTML & "<td width='10%'>" & objItem.Name & "</td>"

strHTML = strHTML & "<td width='10%'>" & objItem.DisplayName  & "</td>"

strHTML = strHTML & "<td width='10%'>" & objItem.StartMode & "</td>"

If objItem.State = "Running" Then

strHTML = strHTML & "<td width='10%'><Font Color='Green'>" & objItem.State & "</Font></td>"

ElseIf objItem.State = "Stopped" Then

strHTML = strHTML & "<td width='10%'><Font Color='Red'>" & objItem.State & "</Font></td>"

End If

Next

 

strHTML = strHTML & "</tr>"

strHTML = strHTML & "</table>"

strHTML = strHTML & "</tr>"

strHTML = strHTML & "<p align='center'> <font color='Blue'>Please Visit myITforum.Com</p>"

strHTML = strHTML & "</tr>"

 

objExplorer.Document.Body.BgColor = "CornSilk"

objExplorer.Document.FgColor = "SaddleBrown"

objExplorer.Document.Body.InnerHTML = strHTML

 

 

Posted by dhite | with no comments
Filed under:

VBS Script To Find ConFigMgr Client Machines With A Specified Product Installed

 

This VBS script will allow you to find all client machines that have a specified product installed. And will send the results to an excel spreadsheet.

 

strProductName Examples:

Microsoft .NET Framework 3.0

%NET Framework 3%

 

VBS Script:

 

strServer = InputBox ("Site Server Name")

strDatabase = InputBox ("Site Code")

strProductName = InputBox ("Product Name")

 

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 = "User Name"

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

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

 

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, SD.User_Name0, SP.ProductName, SP.ProductVersion" & _ 

" From vSMS_G_System_SoftwareProduct SP" & _

" Join System_Disc SD on SD.ItemKey = SP.ClientId" & _

" Where SP.ProductName = '" & strProductName & "' " _

, 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("User_Name0").Value

objExcel.Cells(intRow, 3).Value = objRecordSet.Fields("ProductName").Value

objExcel.Cells(intRow, 4).Value = objRecordSet.Fields("ProductVersion").Value

objRecordSet.MoveNext

intRow = intRow + 1

Loop

 

objExcel.Range("A1:D1").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 List All SIDS For A Specified Domain Server Or Workstation

 

This VBS script will allow you to enter a Domain Controller (DC) Server name or a remote workstation name to list the SIDS

 

DnsAdmins

S-1-5-21-1808774407-1002908778-2105408048-1101

Local

LabServer

DnsAdmins

S-1-5-21-1808774407-1002908778-2105408048-1101

Domain

LabDomain

 

VBS Script:

 

strComputer = InputBox ("Enter Server Name")

 

Set objExcel = CreateObject("Excel.Application")

objExcel.Visible = True

objExcel.Workbooks.Add

intRow = 2

 

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

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

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

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

 

 

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

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

 

For Each objItem in colItems

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

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

If objItem.LocalAccount = TRUE Then

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

ElseIf objItem.LocalAccount = FALSE Then

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

End If

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

intRow = intRow + 1

Next

 

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:
More Posts Next page »