This Vbs script will take an SMS site server name and site code from an input box and then enumerate all of the SMS Web Reports on that server. It will then add them to a Microsoft Word document that you can save for future reference. You can also save the document as a webpage or as an XML document if you are using Microsoft Word 2003.
Note: The script uses the SMS_Report class and exposes its SQLQuery lazy property by using the GET instance for the object property and links the Report ID for the appropriate reports. For more information on lazy properties see the link at the end of this post.
Vbs Script:
strComputer = InputBox ("Enter Site Server Name")
strSiteCode = InputBox("Enter Site Code")
Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()
Set objSelection = objWord.Selection
objSelection.Font.Bold = True
objSelection.TypeText "SMS Web Reports For " & UCase(strComputer)
objSelection.Font.Bold = False
objSelection.TypeParagraph()
objSelection.TypeText "Report Created: " & Date
Set objWMIService = GetObject("winmgmts://" & strComputer & "\root\sms\site_" & strSiteCode)
Set colItems = objWMIService.ExecQuery("Select * from SMS_Report")
For Each objItem in colItems
ReportQuery(objItem.ReportID)
Next
Function ReportQuery(ReportID)
Set lazyproperties = objWMIService.Get("SMS_Report.ReportID=" & ReportID)
objSelection.TypeText lazyproperties.Name
objSelection.TypeText lazyproperties.SQLQuery
End Function
MsgBox "Done"
Those Lazy SMS Properties:
http://myitforum.com/cs2/blogs/dhite/archive/2006/11/17/those-lazy-sms-properties.aspx
Use this Vbs script to enumerate a subnet range or range of IP addresses to determine which machines are or are not SMS clients and send the results to Excel. It will also attempt to determine the IP address and Machines Name for each IP address as well.
Note: The Subnet range must have the following syntax xxx.xxx.xxx. with the trailing “.” at the end of the first Input box prompt.
To make the script input boxes easier to understand I have added examples for each and the input box will be auto populated with them Change them as needed.
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
intRow = 2
objExcel.Cells(1, 1).Value = "IP Address"
objExcel.Cells(1, 2).Value = "Machine Name"
objExcel.Cells(1, 3).Value = "SMS Client"
strSubnet = InputBox("Enter Subnet Range", "strSubnet", "192.168.1.")
intStartingAddress = InputBox("Enter Start Address", "intStartingAddress", "0")
intEndingAddress = InputBox("Enter End Address", "intEndingAddress", "255")
For i = intStartingAddress to intEndingAddress
strTarget = strSubnet & i
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
ExecQuery("select Replysize from Win32_PingStatus where address = '" & strTarget & "'")
For Each objItem in objPing
If IsNull(objItem.ReplySize) Then
IsConnectible = False
Else
On Error Resume Next
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strTarget & "\root\cimv2")
Set colCompSystems = objWMIService.ExecQuery("Select * From " & "Win32_ComputerSystem")
For Each objCompSystem In colCompSystems
objExcel.Cells(intRow, 1).Value = strTarget
objExcel.Cells(intRow, 2).Value = UCase(objCompSystem.Name)
Set objWMIService = GetObject("winmgmts://" & strTarget & "/root/ccm")
Set colItems = objWMIService.ExecQuery("Select * from Sms_Client")
If Err.Number = 0 Then
objExcel.Cells(intRow, 3).Value = "YES"
intRow = intRow + 1
objExcel.Cells(intRow, 3).Value = "NO"
End If
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 objExcel = Nothing
Set objPing = Nothing
Set objWMIService = Nothing
Set colCompSystems = Nothing
Set smsClient = Nothing
Wscript.Echo "Done"
This SQL query will count all of the SMS advanced client machines in your SMS database by Active Directory (AD) site. It will also display the client version number as well as the AD site name.
SQL Query:
Select
AD_Site_Name0 'Active Directory Site',
Client_Version0 'SMS Advanced Client Version Number',
Count(*) 'Totals'
From v_R_System
Where Client0 = 1
And Client_Type0 = 1
group by AD_Site_Name0, Client_Version0
order by AD_Site_Name0, Client_Version0
There are a number of ways that you can troubleshoot TCP/IP configuration issues for your SMS clients. The standard process for troubleshooting these issues is using the Ipconfig command line utility from the command prompt on the machine(s) in question.
Listed here you can see all of the available Ipconfig command line switches available to you for troubleshooting purposes.
Ipconfig /all
This command line switch will display the “Detailed” IP configuration of the client machine.
Ipconfig /release
This command line switch will release the current IP address on the client machines network interface card (NIC).
Ipconfig /renew
This command line switch will renew the current IP address on the client machines NIC card.
Ipconfig /flushDns
This command line switch will flush or purge the client machines DNS cache.
Ipconfig /registerDns
This command line switch will refresh all of the NIC cards leased IP addresses and will re-register the DNS names.
Ipconfig /displayDns
This command line switch will display the DNS cache records.
The SMS Service account in both SMS 2.0 and 2003 must be used sparingly and only when necessary. Just as we try not to use the Administrator account on our domain servers we should try and take the heat off the SMS service account as well.
Because the service account and the administrations account are very powerful accounts and can wreak havoc if misused we must protect them as best we can. The SMS service account in particular has many process threads that rely on it and should be protected.
To take the heat off the SMS service account you should have the following accounts created otherwise the SMS service account will manage them:
Client Push Installation account – This account is used by the Client Configuration Manager to install the SMS client software on your machines.
Site Address account – This account is used for site to site communication and data transfers between sites in a parent child configuration.
Site System Connection account – This account is used by the SMS Site server(s) when connecting to its site systems.
Use this Vbs script to get user input from a Vbs Script:
MsgBoxReply = Msgbox("Ready To Visit SpongeBob SquarePants ?",vbYesNo , "SpongeBob SquarePants Rocks !")
If MsgBoxReply = vbYes Then
' Place Your "YES" Code Here And Remove The Line Below.
MsgBox "Ok Then Tell Gary Hello !"
' Place Your "NO" Code Here And Remove The Line Below.
MsgBox "Patrick Will Sure Miss You !"
Note: You can also use the display button value as opposed to the constant for the Yes and No buttons (vbYesNo) in the script above by replacing vbYesNo with the Value of 4 or
as in the Additional Button Display Options listed at the end of this post.
Constant: vbOKOnly
Value: 0
Buttons: OK only
Constant: vbOKCancel
Value: 1
Buttons: OK and Cancel
Constant: vbAbortRetryIgnore
Value: 2
Buttons: Abort, Retry, and Ignore
Constant: vbYesNoCancel
Value: 3
Buttons: Yes, No, and Cancel
Constant: vbYesNo
Value: 4
Buttons: Yes and No
Constant: vbRetryCancel
Value: 5
Buttons: Retry and Cancel
Note: Thanks to Alex for sending this to me and allowing me to modify and post it here.
Have you ever had one of those days when you wish you could call someone “Stupid” or a “Moron” and cannot find it in your heart to just come out and say so? Well then this list is for you. Here you will find a listing of some alternate means of calling someone a “Stupid Moron”:
Note: Your End Losers, I mean End Users (And other customers) are under no circumstances to be called “Stupid” or “Morons” or any of the alternatives below.
Some of the object properties within SMS are lazy. To be more precise they are ‘Lazy Properties’. This simply means that the data exist but it is not exposed to the SMS Query builder or the SMS console. However it can be accessed using WMI or WbemTest.
As an example in the Sms_Advertisement class the AssignedSchedule and StartTime properties are lazy properties. Within the Sms_Pdf_Package the Icon property is an array containing icon data and it is also a lazy property.
As a rule the data is meaningless numeric data and therefore useless to you. And as I mentioned they can be accessed through various programming languages as well as a WMI class viewer.
Programmatically you can use the Get instance for the object to get the data as in the example below taken from the link at the bottom of this page.
Set colAdvertisements = objSWbemServices.ExecQuery("Select * From SMS_Advertisement")
For Each objAdvert In colAdvertisements
WScript.Echo "ActionInProgress = " & objAdvert.ActionInProgress
WScript.Echo "AdvertFlags = " & objAdvert.AdvertFlags
WScript.Echo "AdvertisementID = " & objAdvert.AdvertisementID
WScript.Echo "AdvertisementName = " & objAdvert.AdvertisementName
'For the lazy properties, get the advertisements individually.
Set lazyproperties = objSWbemServices.Get("SMS_Advertisement.AdvertisementID='" & ObjAdvert.advertisementid & "'")
WScript.Echo "Assigned Schedule = {"
For i=0 to ubound(lazyproperties.assignedschedule,1)
WScript.Echo " instance of " & lazyproperties.Properties_("AssignedSchedule").Value(0).Path_.Class
WScript.Echo lazyproperties.Properties_("AssignedSchedule").Qualifiers_("CIMType")
WScript.Echo " DayDuration: " & lazyproperties.AssignedSchedule(i).DayDuration
WScript.Echo " Hourspan: " & lazyproperties.AssignedSchedule(i).HourSpan
WScript.Echo " IsGMT: " & lazyproperties.AssignedSchedule(i).IsGMT
WScript.Echo " StartTime: " & lazyproperties.AssignedSchedule(i).StartTime
WScript.Echo "AssignedScheduleEnabled = " & lazyproperties.AssignedScheduleEnabled
WScript.Echo "AssignedScheduleIsGMT = " & lazyproperties.AssignedScheduleIsGMT
WScript.Echo "}"
WScript.Echo "CollectionID = " & objAdvert.CollectionID
WScript.Echo "Comment = " & objAdvert.Comment
How to Read Lazy Properties
http://www.microsoft.com/technet/prodtechnol/sms/sms2003/maintain/smsscript/script11.mspx?mfr=true
This Vbs script will create directory names contained in an Excel spreadsheet called C:\NewFolders.xls on a server share.
The Excel file must have one directory name per line in Column A as in the example below:
Folder1
Folder2
Folder3
Note: Be sure to change \\ServerName\ShareName\ as needed.
Set objFSO = CreateObject("Scripting.FileSystemObject")
strPathExcel = "C:\NewFolders.xls"
objExcel.Workbooks.open strPathExcel
Set objSheet = objExcel.ActiveWorkbook.Worksheets(1)
intRow = 1
Do Until objExcel.Cells(intRow, 1).Value = ""
strCN = Trim(objSheet.Cells(intRow, 1).Value)
If objFSO.FolderExists("\\ServerName\ShareName\" & strCN) Then
objFSO.CreateFolder("\\ServerName\ShareName\" & strCN)
Loop
objExcel.Quit
Use the queries below to find the installed applications from the Add and Remove programs (MSI Installed) table for a list of machines.
System.Name0,
Programs.DisplayName00 Application,
Programs.Publisher00 Publisher,