I was recently amending one of my VBS scripts that emulates the SMS administrator consoles “All Systems” collection and writes the information to an Excel spreadsheet to find all of the SMS resources in one of my sites where the machine names began with “ABC-“and found that I had several VBS scripts as well as an HTA script that performed pretty much the same function. As a result I decided to do some midweek Blog posting and post all of them for others to use.
Below you will find links to the HTA script as well as the VBS scripts that I have created over the last few months that emulates the information found in the SMS administrator consoles “All Systems” collection:
HTA Script To Emulate The SMS Consoles All Systems Collection Information
http://myitforum.com/cs2/blogs/dhite/archive/2007/05/30/hta-script-to-emulate-the-sms-consoles-all-systems-collection-information.aspx
Sending All Systems Collection Information For A Specified Machine To Excel
http://myitforum.com/cs2/blogs/dhite/archive/2007/05/30/sending-all-systems-collection-information-for-a-specified-machine-to-excel.aspx
Sending All Systems Collection Information From A List Of Machines To Excel
http://myitforum.com/cs2/blogs/dhite/archive/2007/05/30/sending-all-systems-collection-information-from-a-list-of-machines-to-excel.aspx
Sending All Systems Collection Information To Excel Using Wildcards For Machine Names
http://myitforum.com/cs2/blogs/dhite/archive/2007/05/30/sending-all-systems-collection-information-to-excel-using-wildcards-for-machine-names.aspx
VBS Script To Emulate The SMS Consoles All Systems Collection Information And Send To Excel
http://myitforum.com/cs2/blogs/dhite/archive/2007/05/30/vbs-script-to-emulate-the-sms-consoles-all-systems-collection-information-and-send-to-excel.aspx
This HTA script will take an SMS site server name as well as its site code via input boxes and will write the following results to the active window based on the information contained in the SMS admin console’s “All Systems” Collection (Sms_Cm_Res_Coll_Sms00001): Name, Resource Class, Domain, Site Code, Client, Assigned, Type, Obsolete and Active.
Name
Resource Class
Domain
Site Code
Client
Assigned
Type
Obsolete
Active
ABC1
System
XXX
Yes
Advanced
No
ABC2
XYZ1
XYZ2
Legacy
Note: For a VBS script version of this HTA script that sends the information to an Excel spreadsheet see my previous post below:
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
strComputer = MachineName.Value
strSiteCode = SiteCode.Value
Set objWMIService = GetObject("winmgmts://" & strComputer & "\root\sms\site_" & strSiteCode)
Set colItems = objWMIService.ExecQuery("Select * from Sms_Cm_Res_Coll_Sms00001")
Window.Document.Title = "All Systems Collection For " & UCase(strComputer)
strHTML = "<table border='1' style='border-collapse: collapse' bordercolor='SaddleBrown' id='Table1' >"
strHTML = strHTML & "<tr>"
strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Name</td>"
strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Resource Class</td>"
strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Domain</td>"
strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Site Code</td>"
strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Client</td>"
strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Assigned</td>"
strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Type</td>"
strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Obsolete</td>"
strHTML = strHTML & "<td bgcolor = 'SeaShell'><font color = 'DarkBlue'><b>Active</td>"
strHTML = strHTML & "</tr>"
For Each objItem in colItems
Select Case objItem.IsClient
Case True objIsClient = "Yes"
Case False objIsClient = "No"
End Select
Select Case objItem.IsAssigned
Case True objIsAssigned = "Yes"
Case False objIsAssigned = "No"
Select Case objItem.ClientType
Case 0 objClientType = "Legacy"
Case 1 objClientType = "Advanced"
Case 3 objClientType = "Device"
Select Case objItem.ResourceType
Case 3 objResourceType = "User Group"
Case 4 objResourceType = "User"
Case 5 objResourceType = "System"
Select Case objItem.IsObsolete
Case True objIsObsolete = "Yes"
Case False objIsObsolete = "No"
Select Case objItem.IsActive
Case True objIsActive = "Yes"
Case False objIsActive = "No"
strHTML = strHTML & "<td width='10%'>" & objItem.Name & "</td>"
strHTML = strHTML & "<td width='10%'>" & objResourceType & "</td>"
strHTML = strHTML & "<td width='10%'>" & objItem.Domain & "</td>"
strHTML = strHTML & "<td width='10%'>" & objItem.SiteCode & "</td>"
strHTML = strHTML & "<td width='10%'>" & objIsClient & "</td>"
strHTML = strHTML & "<td width='10%'>" & objIsAssigned & "</td>"
strHTML = strHTML & "<td width='10%'>" & objClientType & "</td>"
strHTML = strHTML & "<td width='10%'>" & objIsObsolete & "</td>"
strHTML = strHTML & "<td width='10%'>" & objIsActive & "</td>"
Next
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>
SMS Server Name: <Input Type = "Text" Name = "MachineName">
SMS 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>
This VBS script will take an SMS site server name as well as its site code via input dialog boxes and will write the following results to an excel spreadsheet based on the information contained in the SMS admin console’s “All Systems” Collection (Sms_Cm_Res_Coll_Sms00001): Name, Resource Class, Domain, Site Code, Client, Assigned, Type, Obsolete and Active.
VBS Script:
strComputer = InputBox ("Enter SMS Server Name")
strSiteCode = InputBox ("Enter Site Code")
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "Name"
objExcel.Cells(1, 2).Value = "Resource Class"
objExcel.Cells(1, 3).Value = "Domain"
objExcel.Cells(1, 4).Value = "Site Code"
objExcel.Cells(1, 5).Value = "Client"
objExcel.Cells(1, 6).Value = "Assigned"
objExcel.Cells(1, 7).Value = "Type"
objExcel.Cells(1, 8).Value = "Obsolete"
objExcel.Cells(1, 9).Value = "Active"
objExcel.Cells(intRow, 1).Value = objItem.Name
objExcel.Cells(intRow, 2).Value = objResourceType
objExcel.Cells(intRow, 3).Value = objItem.Domain
objExcel.Cells(intRow, 4).Value = objItem.SiteCode
objExcel.Cells(intRow, 5).Value = objIsClient
objExcel.Cells(intRow, 6).Value = objIsAssigned
objExcel.Cells(intRow, 7).Value = objClientType
objExcel.Cells(intRow, 8).Value = objIsObsolete
objExcel.Cells(intRow, 9).Value = objIsActive
intRow = intRow + 1
objExcel.Range("A1:I1").Select
objExcel.Selection.Interior.ColorIndex = 19
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Cells.EntireColumn.AutoFit
MsgBox "Done"
This VBS script will take an SMS site server name, site code and a partial machine name where you specify a part of the machine name(s) you want to enumerate via a series of input dialog boxes and will write the following results to an excel spreadsheet based on the information contained in the SMS admin console’s “All Systems” Collection (Sms_Cm_Res_Coll_Sms00001): Name, Resource Class, Domain, Site Code, Client, Assigned, Type, Obsolete and Active.
Note: Change the line that reads: Where Name Like '" & strResource & "%" & "'") To your specified wildcard string (%) string.
The script below will list information about all of your machines where the name is XXX<Something>. For example if you want to gather information for all of your SMS clients where the machine names are <Something>XXX<Something> change the line to read: Where Name Like '" & "%" & strResource & "%" & "'") and so on.
strResource = InputBox ("Enter Machine Name")
Set colItems = objWMIService.ExecQuery("Select * from Sms_Cm_Res_Coll_Sms00001 Where Name Like '" & strResource & "%" & "'")
This VBS script will take an SMS site server name as well as its site code via input dialog boxes and will write the following results to an excel spreadsheet based on the information contained in the SMS admin console’s “All Systems” Collection (Sms_Cm_Res_Coll_Sms00001) from a text file: Name, Resource Class, Domain, Site Code, Client, Assigned, Type, Obsolete and Active.
Note: Change the line that reads: Set InputFile = fso.OpenTextFile("MachineList.Txt") to your text file name as needed.
Set Fso = CreateObject("Scripting.FileSystemObject")
Set InputFile = fso.OpenTextFile("MachineList.Txt")
Do While Not (InputFile.atEndOfStream)
strResource = InputFile.ReadLine
Set colItems = objWMIService.ExecQuery("Select * from Sms_Cm_Res_Coll_Sms00001 Where Name ='" & strResource & "'")
Loop
This VBS script will take an SMS site server name, its site code and a machine name via a series of input dialog boxes and will write the following results to an excel spreadsheet based on the information contained in the SMS admin console’s “All Systems” Collection (Sms_Cm_Res_Coll_Sms00001): Name, Resource Class, Domain, Site Code, Client, Assigned, Type, Obsolete and Active.
Sms_AutoStartSoftware is a new WMI class provided by the installation of SMS Service Pack (SP) 3 that allows for you to see or enumerate the applications set to automatically start when the Operation System is started. The VBS script here will prompt you for an SMS SP3 client machine name and then will list all of the Auto Start applications on the machine to an Excel spreadsheet.
strComputer = InputBox ("Enter SMS Client SP3 Name")
objExcel.Cells(1, 1).Value = "Description"
objExcel.Cells(1, 2).Value = "File Name"
objExcel.Cells(1, 3).Value = "File Version"
objExcel.Cells(1, 4).Value = "Publisher"
objExcel.Cells(1, 5).Value = "Product"
objExcel.Cells(1, 6).Value = "Product Version"
objExcel.Cells(1, 7).Value = "Startup Type"
objExcel.Cells(1, 8).Value = "Startup Value"
objExcel.Cells(1, 9).Value = "Location"
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2\Sms")
Set colItems = objWMIService.ExecQuery("Select * From Sms_AutoStartSoftware")
objExcel.Cells(intRow, 1).Value = objItem.Description
objExcel.Cells(intRow, 2).Value = objItem.FileName
objExcel.Cells(intRow, 3).Value = objItem.FileVersion
objExcel.Cells(intRow, 4).Value = objItem.Publisher
objExcel.Cells(intRow, 5).Value = objItem.Product
objExcel.Cells(intRow, 6).Value = objItem.ProductVersion
objExcel.Cells(intRow, 7).Value = objItem.StartupType
objExcel.Cells(intRow, 8).Value = objItem.StartupValue
objExcel.Cells(intRow, 9).Value = objItem.Location
These Vbs scripts will allow you to browse for an SMS Client log file and then open the file with Notepad or the SMS log file reader.
Specify To Open File With Notepad
Set objDialog = CreateObject("UserAccounts.CommonDialog")
objDialog.Filter = "All Files|*.Log"
objDialog.InitialDir = "C:\WINDOWS\system32\CCM\Logs"
intResult = objDialog.ShowOpen
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "Notepad.exe " & Chr(34) & objDialog.FileName & Chr(34)
Open Files With SMS Trace
Note: If you have the SMS Trace reader (Trace32.Exe) set to open all log files there is no need to specify the application to use to open the selected log files. This is because log files are already associated with Trace32.
WshShell.Run objDialog.FileName
This query will return to you the NetBIOS name for each MachineID in your SMS site. This can be helpful when using the resource explorer to quickly and easily find the machines host name.
SQL Query:
Select
MachineID, Name as 'Machine Name'
From _Res_Coll_SMS00001
Where _Res_Coll_Sms00001.ArchitectureKey = 5
Order by Name ASC
This SQL query will allow you to find CD-ROM media information for a specified machine.
Collection.Name,
CdRom.Description00,
CdRom.Drive0,
CdRom.Manufacturer00,
CdRom.MediaType0
From Cd_Rom_Data CdRom
Join _Res_Coll_Sms00001 Collection
On Collection.MachineID = CdRom.MachineID
Where Collection.Name = 'MachineName'
A Standard Sender in SMS is designed for site to site communications when you have an existing Parent and Child site infrastructure environment. The communication channel is set and defined by an address where the child site(s) have an address pointing back to the parent server.
There may be times when you may find that the address to the Parent site on your Child site(s) has an “Unknown” address. This is more of an anomaly than a problem because the sites involved still function as expected. This can be verified by looking at the Hman log file as well as by verifying the presence of locks on the SMS default collections on the child site because the child site gets its default collections from its parent.
Note: Child sites obtain collection data from the parent site however they do not receive the actual resource list for the collection from the parent site instead the resources for the collection are resources from their own site. As a result all collections that are created on the child site do not have locks on them since they are created at the child site.
As a rule child sites do not know anything about their parent sites and as a result they cannot resolve the address for the parent. This does not affect performance of your SMS site(s) and can just be ignored unless of course you find Sender or Hman log file errors or are experiencing other issues.
The file server role was included in the previous versions of Microsoft Windows Server 2003 however the R2 edition due to customer request has added several additional roles and components found in the chart at the end of this post to the File server role.
Other additional roles have been added to R2 such as the “Other Network File and Print Services” which includes the Subsystem for UNIX-based Applications Client for NFS. Other new roles of importance include SharePoint Services and the Domain Controller (DC) role which when launched begins the Active Directory (AD) Installation Wizard. This component was added to the configure your server applet in order to place all of the components in one readily available location.
Microsoft Windows Server 2003 R2 File Server Components
DFS Management
DFS Replication Service
File Server Management
File Server Resource Manager
Microsoft Services for Network File System
Services for Macintosh.
Storage Management for SANs
UltraEdit has yet to release a syntax highlighting wordfile for PowerShell however I ran across the Bill’s Space Blog page that has one that can be used as is or modified to suit your needs.
You can of course use the Vbs syntax highlighting wordfile for your PowerShell scripts by adding the PS1 file extension to the “File Extensions” line as in the example that follows however it will not include the many PowerShell built-in functions and cmdlets.
File Extensions = VBS WSF PS1
Wordfile For PowerShell
http://www.loytty.com/monadwordfile.txt
This PowerShell script will take a routers IP address (or any other IP address for that matter) from an input box and use the Win32_PingStatus class to verify if the router is on line or off line by reading the StatusCode value where 0 signifies a successful ping code. If the router is on line the Results Set is written in green and if it is not on line it is written in red.
This script can be used at the office by using the Prompted PS1 Script or at home if you have a wireless router using the Specified PS1 Script to be used when you suspect that your router is down by hard coding your Routers IP address.
Note: For a complete list of the available Status Codes for Windows scripting technologies see the chart at the end of this post.
$strIpAddress = Read-Host "Enter IP Address"
Clear
$QueryString = ('Select StatusCode From Win32_PingStatus Where Address = "' + $strIpAddress + '"')
$ResultsSet = Gwmi -Q "$QueryString"
If ($ResultsSet.StatusCode -Eq 0)
{Write-Host -Fore Green "The Router Is On Line"}
Else {Write-Host -Fore Red "The Router Is Off Line"}
# Router IP Address
$strIpAddress ="192.168.1.1"
PingStatus StatusCode Codes
Code
Description
0
Success
11001
Buffer Too Small
11002
Destination Net Unreachable
11003
Destination Host Unreachable
11004
Destination Protocol Unreachable
11005
Destination Port Unreachable
11006
No Resources
11007
Bad Option
11008
Hardware Error
11009
Packet Too Big
11010
Request Timed Out
11011
Bad Request
11012
Bad Route
11013
TimeToLive Expired Transit
11014
TimeToLive Expired Reassembly
11015
Parameter Problem
11016
Source Quench
11017
Option Too Big
11018
Bad Destination
11032
Negotiating IPSEC
11050
General Failure
The term “According to Hoyle” comes from Edmond Hoyle (1672 - 1769) who is known for his work on the rules of card game play. This is primarily because he was considered the authority on the subject when in 1742 he published his “Short Treatise on the Game of Whist” a derivative of Bridge.
The connection between the name Hoyle and card games was made more popular when in 1897 Robert Foster published his book “Foster’s Hoyle” in which can be found rules for card games and ‘Hoyle’ books have been published and updated though the years on a regular basis. Since that time “According to Hoyle” has come to mean the rules of games including games played in our personal lives.