This Vbs script will take an SMS site server name and site code from an input box and then enumerate all of the Queries on that server. It will then add 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 Queries For " & UCase(strComputer)
objSelection.Font.Bold = False
objSelection.TypeParagraph()
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")
For Each objItem in colItems
objSelection.Font.Color = wdColorBlue
objSelection.ParagraphFormat.Shading.BackgroundPatternColor = wdColorGray
objSelection.TypeText objItem.Name
objSelection.Font.Color = wdColorBlack
objSelection.TypeText objItem.Expression
Next
objSelection.TypeText "Created by Don Hite For myITforum.Com"
Additional Information:
VBS Script To Export SMS Web Reports To Microsoft Word
http://myitforum.com/cs2/blogs/dhite/archive/2006/11/28/vbs-script-to-export-sms-web-reports-to-microsoft-word.aspx
Here you will find a SQL query to list SMS client resources that have generated new SMS ID’s along with their Resource ID and the timestamp that the change was generated.
In SMS a new SMSID (SMS Unique ID) or GUID (Globally Unique Identifier) is created when any of the following are changed on your client resources:
SmBIOS Serial Number
The Machine’s System Identifier (SID)
Any one of 10 different Hardware ID Properties
Additional Microsoft Information:
"The Hardware ID mechanism examines 10 computer properties and generates an ID of the Properties by combining hashes of the properties into a single ID. If a certain number of these properties change, the computer is considered, and a new SMSID is created. The number of properties is 3 out of 10 for a desktop computer and 2 of 7 for a laptop computer."
SQL Query:
Select Distinct
SYS.Netbios_Name0 'Machine Name',
Convert(VarChar(10),
SYS.SMS_UUID_Change_Date0, 101) 'Change Generated',
SYS.ResourceID ID
From v_R_System SYS
JOIN v_R_System NEW on SYS.SMS_Unique_Identifier0 = NEW.Previous_SMS_UUID0
Order By 'Machine Name'
To find a list of all the commands available to you from the SCE 2007 PowerShell console you can run the following commands. The first one returns the information to the PowerShell console and the second one saves the results as an HTML webpage.
List To PowerShell console:
$SCE | GM | Select-Object Name
Output to Web Page:
$SCE | GM | Select-Object Name | ConvertTo-Html | Out-File "FileName.Html"
Here you will find links to Ben Pierce’s Windows PowerShell Cheat Sheet Downloads. The downloads are available complements of the PowerShell teams page and are available in Docx, Xps and Pdf versions suitable for printing as a PowerShell quick reference.
Docx Version:
http://blogs.msdn.com/powershell/attachment/1521595.ashx
Xps Version:
http://blogs.msdn.com/powershell/attachment/1561580.ashx
Pdf Version:
http://blogs.msdn.com/powershell/attachment/1525634.ashx
Benp’s Guide To Stuff
http://blogs.technet.com/benp
When someone is Going Cold Turkey it means that they are trying to stop doing something abruptly that affects them physically. For example when alcoholics or drug addicts try to kick the habit they usually get Goose pimples on their skin caused by cold chills.
This strange expression has its origins in the fact that when turkeys are plucked and sent to market their white skin is covered with welts or dumps from where the feathers were pulled out. Someone apparently seen the similarities and the expression stuck.
Boris Yanushpolsky has released an update to his MP Viewer version 1.3 which is available from his Blog page. Updates include the following taken from his original post:
1 - The target of a rule/monitor
2 - The type of a monitor
3 - The priority of the alert generated by a monitor
4 - Whether a rule generates an alert as well as the severity and priority of the alert.
5 - Command line mode is now supported. So you can run it like this: C:\MPViewer.exe "C:\SampleMP.mp" "C:\SampleMPReport.html" (this can help create HTML reports for a large number of management packs without opening each one in the MPViewer UI).
MPViewer Version 1.3 Download
http://blogs.msdn.com/boris_yanushpolsky/attachment/7343239.ashx
Provided here you will find the steps necessary to allow Remote Activation DCOM permissions.
1. Launch the Component Services (Dcomcnfg) MMC snap-in on the server.
2. Expand “Component Services”, expand “Computers”, then right mouse click “My Computer” and from the context menu select “Properties”
3. From the My Computer Properties dialog box select the “COM Security” tab.
4. From the “Launch and Activations Permissions” leaf select “Edit Limits…”
5. Select the “Group or user names:” you wish to enable Remote Activation for and check the box to allow Remote Activation and then click “OK” and close the console.
Note: You can also add a user or group as well by selecting “Add”.
Here you will find the steps necessary to export and then import SQL 2005 registered server information from one database server to another.
1. From the “Registered Servers” window (CTRL+ALT+G) right mouse click on a registered server Database Engine name and from the context menu select “Export”.
2. From the Export Registered Servers task screen expand the “Database Engine” and select the registered server name you want to export. Then from “Export options” enter a location and file name to save the export file to in the “Export file” text box such as \\ServerName\ShareName\FileName and then select “OK” ” to create the XML based file.
3. At the Export Registered Servers dialog box select “OK” to close “The export was successful” Message box.
To Import the information to another database server follow the steps here:
1. From the “Registered Servers” window right mouse click on a registered server Database Engine name and from the context menu select “Import”.
2. From the Import Registered Servers task screen select the ellipsis to browse for the file that you exported in step 2 above and then select “Open”.
3. Next select “OK” and follow the prompts to complete the process.
Example MachineName.RegSrvr File
<?xml version="1.0" encoding="utf-8"?>
<Export serverType="8c91a03d-f9b4-46c0-a305-b5dcc79ff907">
<ServerType id="8c91a03d-f9b4-46c0-a305-b5dcc79ff907" name="Database Engine">
<Server name="MachineName" description="Local instance - 'MachineName'">
<ConnectionInformation>
<ServerType>8c91a03d-f9b4-46c0-a305-b5dcc79ff907</ServerType>
<ServerName>MachineName</ServerName>
<AuthenticationType>0</AuthenticationType>
<UserName />
<Password />
<AdvancedOptions />
</ConnectionInformation>
</Server>
<Server name="MachineName" description="">
<AdvancedOptions>
<CONNECTION_TIMEOUT>15</CONNECTION_TIMEOUT>
<EXEC_TIMEOUT>0</EXEC_TIMEOUT>
<PACKET_SIZE>4096</PACKET_SIZE>
<ENCRYPT_CONNECTION>False</ENCRYPT_CONNECTION>
</AdvancedOptions>
<Group name="Local" description="" />
</ServerType>
</Export>
Here you will find information on the various ways in which you can run the ConfigMgr 2007 Status Message Viewer.
The ConfigMgr Status Message Viewer can be started from within the Console or separate from the console by executing the StatView.Exe utility. It can also be executed from the command line as well.
To execute the Status Message Viewer from outside of the console you can create a shortcut to it from the Location below or simply execute it from that location.
Location:
C:\Program Files\Microsoft Configuration Manager\AdminUI\bin\i386\StatView.Exe
When you launch the application without specifying any command line options the “No Startup Options” dialog box is presented to you where you can choose any of the following options to start the application:
View all Messages
Select an existing query
Terminate the status message viewer now
If you select the first option to “View all Massages” the ConfigMgr Status Message Viewer for <XXX> <SiteName> will be displayed listing all the available status messages.
If you select the option to “Select an existing query” the ConfigMgr Status Message Viewer for <XXX> <SiteName> will be displayed where you have to choose an existing query using the dropdown arrow to select an existing query such as the “Advertisements Crated, Modified, or Deleted” or any of the default status message queries.
The Status Message Viewer can also be accessed from the command line by calling the StatView.Exe using the basic usage syntax below:
Basic Usage:
StatView (Options) @OptionFile1, @OptionFile2 ….
For example if you were to run the following from a script or from the command line it will show only those status messages that reference the Advanced Client component.
StatView /Sms:Component=Advanced Client
To see all of the available options to you run the following: StatView Help and the Status Message Viewer Usage dialog box will be displayed showing the Basic Usage as shown above. From here use the “Options:” drop down menu to see infotmati0on on any of the following:
Basic Query Options
Advanced Command Line Options
Query Type Options
Advanced Query Options
Filter Type Options
Remote Connection Options
Since the help files contents cannot be exported to a text file I have created the following help file for your reference using information taken directly from the graphical help fiole.
StatView Help File
Basic Query Options:
/SMS:DisplayQuery-QueryId
Launch the viewer and display the status view with this Query ID
Advanced Command Line Options:
/SMS:QueryType=QueryValue
/SMS:FilterType=FilterValue or Partial FilterValue
Multiple QueryTypes can be on the same command line or loaded via the ASCII TEXT File option OPTIONFILE. @OPTIONFILE will always include the path to the file or it will be assumed that the file is in this directory when executed. There are no spaces around the "=" and a single space is an indicator between option types. Different QueryTypes on the same command line implies AND between them, while the same QueryType indicates OR. There are no spaces around the "=" and a single space is an indicator between option types. Different QueryTypes on the same command line implies AND between them, while the same QueryType indicates OR.
Query Type Options:
SITE=<SITE STR>
The site code that matches this <SITE STR>
SYSTEM=<SYSTEM STR>
The Windows NT Computer name
SOURCE=<SOURCE MOD STR>
The Source module name such as "SMS SERVER", "SMS CLIENT", etc.
COMPONENT=<COMP STR>
The ConfigMgr Component name as it appears in the Status Message Viewer
SEVERITY=<SEV STR>
The Status Message Severity - INFO, WARNING or ERROR are the only valid values.
MESSAGETYPE=<TYPE>
The Status Message Type - MILESTONE, DETAIL or AUDIT are the only valid values.
MSGID=<MSGID>
The 16-bit Status Message ID.
PROPERETY=<ID>
The attached property.
PROPERETY=<ID>,<STR VALUE>
The attached property set to this value.
STARTTIME=<TIME STR> | Prompt
Include only messages at or after this time. Specify StartTime=Prompt to have the viewer prompt for a start date and time. When using <TIME STR>, time must be formatted as [year][month][day][military time].[microseconds(3 digits)] Example: March 12, 1997 at 1:30 PM would be 1997031213:30.000
ENDTIME=<TIME STR> | Prompt
Include only messages at or before this time. Specify EndTime=Prompt to have the viewer prompt for an end date and time. When using <TIME STR>, time must be formatted as [year][month][day][military time].[microseconds(3 digits)] Example: March 12, 1997 at 1:30 PM would be 1997031213:30.000
Advanced Query Options:
PID=<PID>
The 32-bit process ID
TID=<TID>
The 32-bit thread ID
PERCLIENT=<BOOLEAN>
Messages generated on a per client basis if TRUE, not on a per client if FALSE.
WIN32ERR=<ERROR INT>
The 32-bit error code returned by Win32 GetLastError()
INSSTR<X>=<VALUE>
The value of insertion string X
Filter Type Options:
FSITE=<SITE STR>
The site code or site name that exactly matches this <SITE STR>
FSYSTEM=<SYSTEM STR>
The Windows NT Computer name as displayed by the NET VIEW command. Partial strings are supported.
FSOURCE=<SOURCE MOD STR>
The Source module name such as "SMS SERVER", "SMS CLIENT", "THIRD PARTY", etc. Partial strings are NOT supported.
FCOMPONENT=<COMP STR>
The ConfigMgr Component name as it appears in the Status Message Viewer. Partial values are supported.
FSEVERITY=<SEV STR>
FMESSAGETYPE=<TYPE>
The Status Message Typel - MILESTONE, DETAIL or AUDIT are the only valid values.
FMSGID=<MSGID>
FPROPERTY=<ID>
FPROPERTY=<ID>, <STR VALUE>
FDESCRIPT=”<String To Match>”
The description string for a specific message ID. This option supports partial strings.
FPID=<PID>
FTID=<TID>
FSTARTTIME=<TIME STR> | Prompt
Include only messages at or after this time. Time must be formatted in as [year][month][day][military time].[microseconds(3 digits)] Example: March 12, 1997 at 1:30 PM would be 1997031213:30.000
FENDTIME=<TIME STR> | Prompt
Include only messages on or before this time. Time must be formatted as [year][month][day][military time].[microseconds(3 digits)] Example: March 12, 1997 at 1:30 PM would be 1997031213:30.000
Remote Connection Options:
Server=\\ServerName\
This is the name of the remote server to connect to.
Path=NameSpacce
This is the namespace of the remote server to connect to. Example: Root\SMS\SiteCode
This VBS script will take a Domain Controller (DC) Name from an input box and write the following domain information to an excel spreadsheet.
DC Name, Domain Name, Client Site Name, Site Name, Description, DNS Forest Name, Directory Service, DNS Controller, DNS Domain, DNS Forest, Global Catalog, Kerberos Distribution Center, Primary Domain Controller and Time Service
Set objExcel = CreateObject("Excel.Application")
objExcel.Visible = True
objExcel.Workbooks.Add
objExcel.Cells(1, 1).Value = "DC Name"
objExcel.Cells(2, 1).Value = "Domain Name"
objExcel.Cells(3, 1).Value = "Client Site Name"
objExcel.Cells(4, 1).Value = "Site Name"
objExcel.Cells(5, 1).Value = "Description"
objExcel.Cells(6, 1).Value = "DNS Forest Name"
objExcel.Cells(7, 1).Value = "Directory Service"
objExcel.Cells(8, 1).Value = "DNS Controller"
objExcel.Cells(9, 1).Value = "DNS Domain"
objExcel.Cells(10, 1).Value = "DNS Forest"
objExcel.Cells(11, 1).Value = "Global Catalog"
objExcel.Cells(12, 1).Value = "Kerberos Distribution Center"
objExcel.Cells(13, 1).Value = "Primary Domain Controller"
objExcel.Cells(14, 1).Value = "Time Service"
strComputer = InputBox("Enter Domain Controller Name")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\Cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_NtDomain")
objExcel.Cells(1, 2).Value = objItem.DomainControllerName
objExcel.Cells(2, 2).Value = objItem.DomainName
objExcel.Cells(3, 2).Value = objItem.ClientSiteName
objExcel.Cells(4, 2).Value = objItem.DcSiteName
objExcel.Cells(5, 2).Value = objItem.Description
objExcel.Cells(6, 2).Value = objItem.DnsForestName
If objItem.DSDirectoryServiceFlag = True Then
objExcel.Cells(7, 2).Value = "Yes"
Else
objExcel.Cells(7, 2).Value = "No"
End If
If objItem.DSDnsControllerFlag = True Then
objExcel.Cells(8, 2).Value = "Yes"
objExcel.Cells(8, 2).Value = "No"
If objItem.DSDnsDomainFlag = True Then
objExcel.Cells(9, 2).Value = "Yes"
objExcel.Cells(9, 2).Value = "No"
If objItem.DSDnsForestFlag = True Then
objExcel.Cells(10, 2).Value = "Yes"
objExcel.Cells(10, 2).Value = "No"
If objItem.DSGlobalCatalogFlag = True Then
objExcel.Cells(11, 2).Value = "Yes"
objExcel.Cells(11, 2).Value = "No"
If objItem.DSKerberosDistributionCenterFlag = True Then
objExcel.Cells(12, 2).Value = "Yes"
objExcel.Cells(12, 2).Value = "No"
If objItem.DSPrimaryDomainControllerFlag = True Then
objExcel.Cells(13, 2).Value = "Yes"
objExcel.Cells(13, 2).Value = "No"
If objItem.DSTimeServiceFlag = True Then
objExcel.Cells(14, 2).Value = "Yes"
objExcel.Cells(14, 2).Value = "No"
objExcel.Range("A1:A14").Select
objExcel.Selection.Font.ColorIndex = 11
objExcel.Selection.Font.Bold = True
objExcel.Range("A1:B1").Select
objExcel.Cells.EntireColumn.AutoFit
This SQL server script will display all of the SQL user type tables in a given database using DatabaseName and SqlQuery variables.
Declare @DatabaseName SysName
Declare @SqlQuery VarChar(200)
-- Change SMS_XXX To The Database you wish to query
Set @DatabaseName='SMS_XXX'
Set @SqlQuery='Select Table_Name as Tables From ' + @DatabaseName + '.Information_Schema.Tables
Where Table_Type = ''Base Table'''
Exec (@SqlQuery)
The Windows Server 2008 Reviewers Guide provides a comprehensive technical overview of the innovative features and functions that make Windows Server 2008 the next-generation Microsoft Windows Server operating system and successor to Microsoft Windows Server 2003. This guide also provides information about the benefits Windows Server 2008 offers diverse users, as well as information about different scenarios.
Download:
http://technet.microsoft.com/en-us/windowsserver/2008/bb414776.aspx