Microsoft KB Archive/925642: Difference between revisions
m (Text replacement - "<" to "<") |
m (Text replacement - ">" to ">") |
||
Line 135: | Line 135: | ||
'Connect to the remote server | 'Connect to the remote server | ||
Set oServices = GetObject("winMgmts:" & oSite.SMSNameSpace) | Set oServices = GetObject("winMgmts:" & oSite.SMSNameSpace) | ||
If Err.number < | If Err.number <> 0 Then | ||
WScript.Echo "Error connecting to SMS namespace:" & oSite.SMSNameSpace | WScript.Echo "Error connecting to SMS namespace:" & oSite.SMSNameSpace | ||
WScript.Echo "Error = " & Err.number & " - " & Err.Description | WScript.Echo "Error = " & Err.number & " - " & Err.Description | ||
Line 172: | Line 172: | ||
oNewReport.Put_() | oNewReport.Put_() | ||
If Err.number < | If Err.number <> 0 Then | ||
WScript.Echo "Report failed to transfer to site " & oSite.SiteCode | WScript.Echo "Report failed to transfer to site " & oSite.SiteCode | ||
WScript.Echo "Error = " & Err.number & " - " & Err.Description | WScript.Echo "Error = " & Err.number & " - " & Err.Description | ||
Line 201: | Line 201: | ||
Dim iID | Dim iID | ||
iID = WScript.Arguments(0) | iID = WScript.Arguments(0) | ||
If Err.number < | If Err.number <> 0 Then | ||
WScript.Echo "Failed to get report ID from command line!" | WScript.Echo "Failed to get report ID from command line!" | ||
DisplayHelp() | DisplayHelp() | ||
Line 254: | Line 254: | ||
For each oSiteServer in aSiteServerNames | For each oSiteServer in aSiteServerNames | ||
sNameSpace = GetRemoteSMSNameSpace(oSiteServer.ServerName) | sNameSpace = GetRemoteSMSNameSpace(oSiteServer.ServerName) | ||
If sNameSpace < | If sNameSpace <> FALSE Then | ||
Set oSiteObject = New ChildSite | Set oSiteObject = New ChildSite | ||
oSiteObject.SiteCode = oSiteServer.SiteCode | oSiteObject.SiteCode = oSiteServer.SiteCode | ||
Line 276: | Line 276: | ||
Dim colNameSpaceQuery, refitem, refWMI | Dim colNameSpaceQuery, refitem, refWMI | ||
Set refWMI = GetObject("winMgmts:\root\sms") | Set refWMI = GetObject("winMgmts:\root\sms") | ||
If Err.number < | If Err.number <> 0 Then | ||
WScript.Echo "Error connecting to SMS namespace" | WScript.Echo "Error connecting to SMS namespace" | ||
DisplayHelp() | DisplayHelp() | ||
Line 294: | Line 294: | ||
Dim colNameSpaceQuery, refitem, refWMI | Dim colNameSpaceQuery, refitem, refWMI | ||
Set refWMI = GetObject("winMgmts:\\" & sServer & "\root\sms") | Set refWMI = GetObject("winMgmts:\\" & sServer & "\root\sms") | ||
If Err.number < | If Err.number <> 0 Then | ||
WScript.Echo "Error connecting to SMS namespace on " & sServer | WScript.Echo "Error connecting to SMS namespace on " & sServer | ||
WScript.Echo "Error = " & Err.number & " - " & Err.Description | WScript.Echo "Error = " & Err.number & " - " & Err.Description | ||
Line 311: | Line 311: | ||
Sub DisplayHelp() | Sub DisplayHelp() | ||
WScript.Echo "Syntax for ImportReport.vbs (must be run on parent site server)" | WScript.Echo "Syntax for ImportReport.vbs (must be run on parent site server)" | ||
WScript.Echo "cscript.exe ImportReport.vbs <ReportID | WScript.Echo "cscript.exe ImportReport.vbs <ReportID> <ChildSiteCode(s)>" | ||
WScript.Echo "Example: cscript.exe ImportReport.vbs 166 PRI SEC CLD" | WScript.Echo "Example: cscript.exe ImportReport.vbs 166 PRI SEC CLD" | ||
End Sub | End Sub |
Revision as of 10:25, 21 July 2020
Article ID: 925642
Article Last Modified on 10/27/2006
APPLIES TO
- Microsoft Systems Management Server 2003
SYMPTOMS
When you use the Import Object Wizard to import a report into Microsoft Systems Management Server (SMS) 2003, you experience the following symptoms:
- The Import Object Wizard stops responding (hangs).
- The Mmc.exe process uses approximately 99 percent of CPU resources.
- The report is not imported successfully.
Note In this situation, you must end, or "terminate," the Mmc.exe process to exit the Import Object Wizard.
You experience this problem if you import a report that contains a large SQL query.
CAUSE
This problem occurs because of a limitation in the Import Object Wizard. The Import Object Wizard buffer cannot handle large SQL queries.
WORKAROUND
To work around this problem, use one of the following methods, as appropriate for the situation.
Method 1: Paste the SQL query into a new report
Instead of using the Export Object Wizard to export and then import the report information, copy the SQL query that you want to a new report. To do this, follow these steps.
- Copy the SQL query from the source report. To do this, follow these steps:
- Start the SMS Administrator console Microsoft Management Console (MMC) snap-in.
- Expand Reporting, and then click Reports.
- Right-click the report from which you want to copy the SQL query, and then click Properties.
- In the
ReportName
Properties dialog box, click Edit SQL Statement. - In the Report SQL Statement dialog box, copy the SQL statement that appears in the SQL statement box to a text file.
- Click Cancel two times.
- Paste the SQL query into a new report. To do this, follow these steps:
- In the SMS Administrator console MMC snap-in, expand Reporting, right-click Reports, point to New, and then click Report.
- In the Report Properties dialog box, type a name in the Name box.
- In the Category list, click an appropriate report category such as Software Update - Compliance, and then click Edit SQL Statement.
- In the Report SQL Statement dialog box, paste the SQL statement that you copied in step 1e into the SQL statement box.
- Click OK two times.
Method 2: Use a script to copy the SQL query to a new report
Microsoft provides programming examples for illustration only, without warranty either expressed or implied. This includes, but is not limited to, the implied warranties of merchantability or fitness for a particular purpose. This article assumes that you are familiar with the programming language that is being demonstrated and with the tools that are used to create and to debug procedures. Microsoft support engineers can help explain the functionality of a particular procedure, but they will not modify these examples to provide added functionality or construct procedures to meet your specific requirements.
You can use the SMS 2003 software development kit (SDK) to export and import a report. The following example script illustrates how you can do this.
'Run locally on the central site server where the report exists '1st parameter should be the report ID 'The remaining parameters should be the site codes of the... '...child sites for which you want to import the report 'Example: cscript.exe ImportReport.vbs 166 PRI SEC CLD 'This will take report 166 and import it into the PRI, SEC, and CLD child sites 'Start Script Main Sub Main Dim oServices, iReportID, aSites 'Make connection to WMI Set oServices = GetObject("winMgmts:" & GetSMSNameSpace()) 'Get Command Line Arguments iReportID = GetReportID() aSites = GetSiteNamespaces(oServices) 'Make sure report exists If ValidateReport(oServices, iReportID) Then TransferReport oServices, iReportID, aSites Else WScript.Echo "Report ID " & iReportID & " is not a valid report ID" DisplayHelp() WScript.Quit End If Set oServices = Nothing End Sub Sub TransferReport(oWMI, iID, aSites) On Error Resume Next Dim oQuery, oReport, oServices, oSite, oNewReport, oLazySQLQuery 'Get main report object Set oQuery = oWMI.ExecQuery("select * from SMS_Report where ReportID = " & iID) For each oReport in oQuery For each oSite in aSites 'Connect to the remote server Set oServices = GetObject("winMgmts:" & oSite.SMSNameSpace) If Err.number <> 0 Then WScript.Echo "Error connecting to SMS namespace:" & oSite.SMSNameSpace WScript.Echo "Error = " & Err.number & " - " & Err.Description WScript.Echo "Will not transfer report to " & oSite.ServerName Else 'Create a new report and clone it so it's identical to the original Set oNewReport = oServices.Get("SMS_Report").SpawnInstance_ 'Set properties oNewReport.Category = oReport.Category oNewReport.Comment = oReport.Comment oNewReport.DrillThroughColumns = oReport.DrillThroughColumns oNewReport.DrillThroughURL = oReport.DrillThroughURL oNewReport.GraphCaption = oReport.GraphCaption oNewReport.GraphType = oReport.GraphType oNewReport.GraphXCol = oReport.GraphXCol oNewReport.GraphYCol = oReport.GraphYCol oNewReport.Name = oReport.Name oNewReport.NumPrompts = oReport.NumPrompts oNewReport.RefreshInterval = oReport.RefreshInterval oNewReport.ReportParams = oReport.ReportParams oNewReport.StatusMessageDetailSource = oReport.StatusMessageDetailSource oNewReport.XColLabel = oReport.XColLabel oNewReport.YColLabel = oReport.YColLabel 'Set lazy properties 'Note, report ID's may not match for the 1st two properties oNewReport.DrillThroughReportID = oReport.DrillThroughReportID oNewReport.DrillThroughReportPath = oReport.DrillThroughReportPath oNewReport.MachineDetail = oReport.MachineDetail oNewReport.MachineSource = oReport.MachineSource Set oLazySQLQuery = oWMI.Get("SMS_Report.ReportID=" & iID) oNewReport.SQLQuery = oLazySQLQuery.SQLQuery 'Write the instance to WMI oNewReport.Put_() If Err.number <> 0 Then WScript.Echo "Report failed to transfer to site " & oSite.SiteCode WScript.Echo "Error = " & Err.number & " - " & Err.Description Else WScript.Echo "Report transfered to site " & oSite.SiteCode End If End If Next Next Set oServices = Nothing Set oLazySQLQuery = Nothing End Sub Function ValidateReport(oWMI, iID) On Error Resume Next Dim oQuery, oItem Set oQuery = oWMI.ExecQuery("select * from SMS_Report where ReportID = " & iID) For Each oItem in oQuery WScript.Echo "Report to transfer: " & oItem.Name ValidateReport = TRUE Next Set oQuery = Nothing End Function Function GetReportID() On Error Resume Next Dim iID iID = WScript.Arguments(0) If Err.number <> 0 Then WScript.Echo "Failed to get report ID from command line!" DisplayHelp() WScript.Quit Else GetReportID = iID End If End Function Function GetSiteNameSpaces(oWMI) On Error Resume Next Dim aArg, oSites, oSite, i, oSiteServer, sNameSpace Dim aAllData(), aSiteServerNames(), aArgs() 'Get child site codes off command line If WScript.Arguments.Count < 2 Then WScript.Echo "Failed to get child site codes from command line!" DisplayHelp() WScript.Quit End if For i = 1 to WScript.Arguments.Count - 1 ReDim Preserve aArgs(i-1) aArgs(i-1) = WScript.Arguments(i) Next 'Make sure we actually got some child site codes If i <= 1 Then WScript.Echo "Failed to get child site codes from command line" DisplayHelp() WScript.Quit End If 'Query WMI to get SMS server names for each site code i = 0 Set oSites = oWMI.ExecQuery("select * from SMS_Site") For each oSite in oSites For each aArg in aArgs If UCASE(aArg) = UCASE(oSite.SiteCode) Then Set oSiteObject = New ChildSite oSiteObject.SiteCode = oSite.SiteCode oSiteObject.ServerName = oSite.ServerName ReDim Preserve aSiteServerNames(i) Set aSiteServerNames(i) = oSiteObject i = i + 1 End If Next Next 'Connect to each site server to get the SMS namespace i = 0 For each oSiteServer in aSiteServerNames sNameSpace = GetRemoteSMSNameSpace(oSiteServer.ServerName) If sNameSpace <> FALSE Then Set oSiteObject = New ChildSite oSiteObject.SiteCode = oSiteServer.SiteCode oSiteObject.ServerName = oSiteServer.ServerName oSiteObject.SMSNameSpace = sNameSpace ReDim Preserve aAllData(i) Set aAllData(i) = oSiteObject i = i + 1 End If Next GetSiteNameSpaces = aAllData Set oSites = Nothing Set oSite = Nothing Set oSiteServer = Nothing End Function Function GetSMSNameSpace() On Error Resume Next Dim colNameSpaceQuery, refitem, refWMI Set refWMI = GetObject("winMgmts:\root\sms") If Err.number <> 0 Then WScript.Echo "Error connecting to SMS namespace" DisplayHelp() WScript.Quit End If Set colNameSpaceQuery = refWMI.ExecQuery("select * from SMS_ProviderLocation") For Each refitem in colNameSpaceQuery GetSMSNameSpace = refitem.NamespacePath Next Set colNameSpaceQuery = Nothing Set refitem = Nothing Set refWMI = Nothing End Function Function GetRemoteSMSNameSpace(sServer) On Error Resume Next Dim colNameSpaceQuery, refitem, refWMI Set refWMI = GetObject("winMgmts:\\" & sServer & "\root\sms") If Err.number <> 0 Then WScript.Echo "Error connecting to SMS namespace on " & sServer WScript.Echo "Error = " & Err.number & " - " & Err.Description WScript.Echo "Will not transfer report to " &sServer GetRemoteSMSNameSpace = FALSE End If Set colNameSpaceQuery = refWMI.ExecQuery("select * from SMS_ProviderLocation") For Each refitem in colNameSpaceQuery GetRemoteSMSNameSpace = refitem.NamespacePath Next Set colNameSpaceQuery = Nothing Set refitem = Nothing Set refWMI = Nothing End Function Sub DisplayHelp() WScript.Echo "Syntax for ImportReport.vbs (must be run on parent site server)" WScript.Echo "cscript.exe ImportReport.vbs <ReportID> <ChildSiteCode(s)>" WScript.Echo "Example: cscript.exe ImportReport.vbs 166 PRI SEC CLD" End Sub Class ChildSite Public SiteCode Public ServerName Public SMSNamespace End Class
STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
MORE INFORMATION
The following file is available for download from the Microsoft Download Center:
Download the Systems Management Server 2003 Software Development Kit (SDK) v3.1 package now.
Release Date: July 22, 2005
For more information about how to download Microsoft support files, click the following article number to view the article in the Microsoft Knowledge Base:
119591 How to obtain Microsoft support files from online services
Microsoft scanned this file for viruses. Microsoft used the most current virus-detection software that was available on the date that the file was posted. The file is stored on security-enhanced servers that help prevent any unauthorized changes to the file.
Keywords: kbpending kbenv kbtshoot kbbug kbprb KB925642