This VBS script will allow you to enter a Site server name and Site code into input dialog boxes and will then locate all machines that have a shared or duplicate Globally Unique Identifier (GUID) and send the old and new machine names to excel.
For additional information see the link at the end of this post.
strServer = InputBox ("Enter Site Server Name")
strDatabase = InputBox ("Enter Three Letter Site Code")
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
intRow = 2
objExcel.Cells(1, 1).Value = "Old Name"
objExcel.Cells(1, 2).Value = "New Name"
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 SH.Name0 Old, SD.Name0 New" & _
" From System_Data SD" & _
" Join System_Hist SH on SH.MachineId = SD.MachineId" & _
" And SD.Name0 Not Like SH.Name0" , objConnection, adOpenStatic, adLockOptimistic
Do Until objRecordSet.EOF
objExcel.Cells(intRow, 1).Value = objRecordSet.Fields("Old").Value
objExcel.Cells(intRow, 2).Value = objRecordSet.Fields("New").Value
intRow = intRow + 1
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
Set objRange = objExcel.Range("A1")
Managing Duplicate Globally Unique Identifiers in Systems Management Server 2003
This Vbs script will take an SMS site server name and site code from an input box and then enumerate all of the System 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.
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 System Resource Queries For " & UCase(strComputer)
objSelection.Font.Bold = False
objSelection.TypeText "Report Created: " & Date
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_System'")
For Each objItem in colItems
objSelection.Font.Color = wdColorBlue
objSelection.ParagraphFormat.Shading.BackgroundPatternColor = wdColorGray
objSelection.Font.Color = wdColorBlack
objSelection.TypeText "Created by Don Hite For myITforum.Com"
VBS Script To Export SMS Queries To Microsoft Word
This VBS script will allow you browse for a text file and then convert it from a comma delimited text file to a tab delimited text file. You can also change the Replace string character from the comma to another value such as = as needed.
You can also take the script one step further by changing the comma to a string value and the vbTab to yet another sting value by using the syntax here:
strNewFile = Replace(strTextCharacter, "Old_String", "New_String",)
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "Text Files|*.Txt"
objDialog.InitialDir = "C:\"
intResult = objDialog.ShowOpen
Set WshShell = WScript.CreateObject("WScript.Shell")
Const ForReading = 1
Const ForWriting = 2
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(objDialog.FileName, ForReading)
strTextCharacter = objFile.ReadAll
strNewFile = Replace(strTextCharacter, ",", vbTab)
Set objFile = objFSO.OpenTextFile(objDialog.FileName, ForWriting)
This SQL query will allow you to find and count software file and product information for a specified executable.
SF.FileId 'File ID',
SF.ProductId 'Product ID',
SF.FileName 'File Name',
SF.FileDescription 'File Description',
SF.FileSize 'File Size',
SF.FileVersion 'File Version',
SP.ProductName 'Product Name',
SP.ProductVersion 'Product Version',
SP.CompanyName 'Company Name',
Count(SF.FileName) 'Installed Count'
From System_DISC SD
Join vSMS_G_System_SoftwareFile SF on SF.ClientId = SD.ItemKey
Join vSMS_G_System_SoftwareProduct SP on SP.ClientId = SD.ItemKey
Where SF.ProductId = SP.ProductId
And SF.FileName = 'FileName.Exe'
Group by SF.FileId,SF.ProductId,SF.FileName,SF.FileDescription,
Order By SF.FileId ASC
This query will return the number of software file records in the current database. Just for fun execute it to see just how many unique file executables you have in your database and be prepared for a shock
Select Count(*) as 'Total Number Of Records'
When someone states that they are going to go and see a man about a horse (Or Dog) it is meant to imply that they are going to leave your presence and want to conceal the true reason for their departure.
For example if someone is going out for a drink\smoke or going to go to the bathroom they often say that they are going to see a man about a horse.
Microsoft has released its successor to the Business Desktop Deployment (BDD) 2007 solution accelerator called the Microsoft Deployment Toolkit (MDT) 2008. This update now includes support for Windows Vista Service Pack (SP1) and Windows Server 2008.
Microsoft Deployment Toolkit 2008
The PssDiag Data collection utility is a Microsoft Product Support Services (PSS) diagnostic data collector tool for Microsoft SQL Server used by PSS engineers to collect diagnostic data from end user installations and can also be used by end-users to troubleshoot and monitor their own SQL Server installations.
To run simply unzip the files to a directory folder of your choice and then run the DiagConfig.Exe. At the Target Machine dialog box enter the name of the SQL server you want to diagnose into the “Machine” text box and select “OK” to begin.
This will bring up the Diag Manager graphical user interface. Then click on the “Start” button in the upper right hand side of the dialog and this will bring up the Startup Parameters interface where you can select the appropriate radial buttons as required. When you have competed your selections click OK to begin the diagnostics.
PssDiag Diagnostics Download
In ConfigMgr 2007 you may find that when you manually or programmatically remove a machine that has been either decommissioned or reimaged from the “All Systems” collection that resource name reappears in the collection(s) during the subsequent Active Directory Systems Discovery process.
This functionality is by default because ConfigMgr has determined that the NetBIOS name is still an active member of the domain(s) you have configured as a ConfigMgr domain(s) even though to your knowledge the machine is a nonexistent resource.
Active Directory Systems Discovery determines active computer resources by looking for machine or computer accounts in the Active Directory Domain Services. When it finds a new potential client resource it attempts to ping the computer and if a ping request is confirmed as having a successful IP Address Name Resolution a Data Discovery Record (DDR) is created for the computer resource and it is “Discovered” and this is when the machine reappears in your ConfigMgr database.
To combat this issue you must remove the computer name(s) from the Active Directory Users And Computers application. Then you can remove the resource once again from your site server. After this has been accomplished the resource should not reappear during the next Active Directory Systems Discovery process interval
Note: You should also enable and configure DNS Scavenging on your DNS servers as well to ensure that the issue does not reemerge. For additional information see the post below:
DNS Aging And Scavenging
Client health monitoring is not new to SMS or ConFigMgr however Microsoft has provided us with tools to ease this responsibility. There is the SMS 2003 Client Health Monitoring Tool as well as other means in which you can ensure that your clients are responding and functioning as expected.
Paul Thomsen has written a Blog post on client health solutions that are worth looking at found at the link below. He discusses some of the solutions that are available and if you have anything to add of use for client health monitoring please post your comments or solutions to his post or here.
Client Health Solutions
This by request VBS script will allow you to enter a remote client machine name and will open the clients CcmSetup directory folder.
strcomputer = InputBox ("Enter Client Machine Name")
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "Explorer \\" & strComputer & "\Admin$\System32\CcmSetup"
Sir Arthur Charles Clarke (1917 – 2008) British science fiction author.
This VBS script will allow you to enter a Directory Folder name and will list all of the files in the directory folder along with their last accessed date timestamp.
strDirectoryFolder = InputBox ("Enter Directory Folder Name")
objExcel.Cells(1, 1).Value = "File Name"
objExcel.Cells(1, 2).Value = "Last Accessed"
Set Fso = CreateObject("Scripting.FileSystemObject")
Set objDirectory = Fso.GetFolder(strDirectoryFolder)
For Each objFile in objDirectory.Files
objExcel.Cells(intRow, 1).Value = objFile.Name
objExcel.Cells(intRow, 2).Value = objFile.DateLastAccessed
objExcel.Selection.Interior.ColorIndex = 19
Set objRange = objExcel.Range("A2")
This VBS script will allow you to enter a machine name, drive letter and file extension to search for and write the results to an excel spreadsheet. It will capture the File name, File size, File path, Creation date and last accessed date.
The script can be used to find Mp3 files on a remote machine or find all of the Outlook Pst files on a user file share.
strComputer = InputBox ("Enter Machine Name")
strDrive = InputBox ("Enter Drive Letter")
strExtension = InputBox ("Enter File Extension")
objExcel.Cells(1, 2).Value = "File Size"
objExcel.Cells(1, 3).Value = "Path"
objExcel.Cells(1, 4).Value = "Creation Date"
objExcel.Cells(1, 5).Value = "Last Accessed"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colFiles = objWMIService.ExecQuery _
("Select * from CIM_DataFile Where Drive = '" & strDrive & "' And Extension = '" & strExtension & "'")
For Each objItem in colFiles
objExcel.Cells(intRow, 1).Value = objItem.FileName
objExcel.Cells(intRow, 2).Value = FormatNumber(objItem.FileSize/1024/1024,1) & " MB"
objExcel.Cells(intRow, 3).Value = objItem.Path
objExcel.Cells(intRow, 4).Value = ConvWbemTime(objItem.CreationDate)
objExcel.Cells(intRow, 5).Value = ConvWbemTime(objItem.LastAccessed)
sMonth = mid(IntervalFormat,5,2)
sDay = mid(IntervalFormat,7,2)
sYear = mid(IntervalFormat,1,4)
sHour = mid(IntervalFormat,9,2)
sMinutes = mid(IntervalFormat,11,2)
sSeconds = mid(IntervalFormat,13,2)
ConvWbemTime = sMonth & "-" & sDay & "-" & sYear & " " & sHour & ":" & sMinutes & ":" & sSeconds