Microsoft KB Archive/925642

= The Import Object Wizard stops responding and the Mmc.exe process uses 99 percent of CPU resources when you try to import a report in Systems Management Server 2003 =

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 &quot;terminate,&quot; 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  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.</li></ol> </li> Paste the SQL query into a new report. To do this, follow these steps: <ol style="list-style-type: lower-alpha;"> In the SMS Administrator console MMC snap-in, expand Reporting, right-click Reports, point to New, and then click Report.</li> In the Report Properties dialog box, type a name in the Name box.</li> In the Category list, click an appropriate report category such as Software Update - Compliance, and then click Edit SQL Statement.</li> In the Report SQL Statement dialog box, paste the SQL statement that you copied in step 1e into the SQL statement box.</li> Click OK two times.</li></ol> </li></ol>

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.

<div class="workaround_section">

'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(&quot;winMgmts:&quot; & 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 &quot;Report ID &quot; & iReportID & &quot; is not a valid report ID&quot; 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(&quot;select * from SMS_Report where ReportID = &quot; & iID) For each oReport in oQuery For each oSite in aSites 'Connect to the remote server Set oServices = GetObject(&quot;winMgmts:&quot; & oSite.SMSNameSpace) If Err.number <> 0 Then WScript.Echo &quot;Error connecting to SMS namespace:&quot; & oSite.SMSNameSpace WScript.Echo &quot;Error = &quot; & Err.number & &quot; - &quot; & Err.Description WScript.Echo &quot;Will not transfer report to &quot; & oSite.ServerName Else 'Create a new report and clone it so it's identical to the original Set oNewReport = oServices.Get(&quot;SMS_Report&quot;).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(&quot;SMS_Report.ReportID=&quot; & iID) oNewReport.SQLQuery = oLazySQLQuery.SQLQuery 'Write the instance to WMI oNewReport.Put_ If Err.number <> 0 Then WScript.Echo &quot;Report failed to transfer to site &quot; & oSite.SiteCode WScript.Echo &quot;Error = &quot; & Err.number & &quot; - &quot; & Err.Description Else WScript.Echo &quot;Report transfered to site &quot; & 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(&quot;select * from SMS_Report where ReportID = &quot; & iID) For Each oItem in oQuery WScript.Echo &quot;Report to transfer: &quot; & 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 &quot;Failed to get report ID from command line!&quot; 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 &quot;Failed to get child site codes from command line!&quot; 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 &quot;Failed to get child site codes from command line&quot; DisplayHelp WScript.Quit End If   'Query WMI to get SMS server names for each site code i = 0 Set oSites = oWMI.ExecQuery(&quot;select * from SMS_Site&quot;) 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(&quot;winMgmts:\root\sms&quot;) If Err.number <> 0 Then WScript.Echo &quot;Error connecting to SMS namespace&quot; DisplayHelp WScript.Quit End If   Set colNameSpaceQuery = refWMI.ExecQuery(&quot;select * from SMS_ProviderLocation&quot;) 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(&quot;winMgmts:\\&quot; & sServer & &quot;\root\sms&quot;) If Err.number <> 0 Then WScript.Echo &quot;Error connecting to SMS namespace on &quot; & sServer WScript.Echo &quot;Error = &quot; & Err.number & &quot; - &quot; & Err.Description WScript.Echo &quot;Will not transfer report to &quot; &sServer GetRemoteSMSNameSpace = FALSE End If   Set colNameSpaceQuery = refWMI.ExecQuery(&quot;select * from SMS_ProviderLocation&quot;) For Each refitem in colNameSpaceQuery GetRemoteSMSNameSpace = refitem.NamespacePath Next Set colNameSpaceQuery = Nothing Set refitem = Nothing Set refWMI = Nothing End Function

Sub DisplayHelp WScript.Echo &quot;Syntax for ImportReport.vbs (must be run on parent site server)&quot; WScript.Echo &quot;cscript.exe ImportReport.vbs <ReportID> <ChildSiteCode(s)>&quot; WScript.Echo &quot;Example: cscript.exe ImportReport.vbs 166 PRI SEC CLD&quot; End Sub

Class ChildSite Public SiteCode Public ServerName Public SMSNamespace End Class

<div class="status_section">

STATUS
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the &quot;Applies to&quot; section.

<div class="moreinformation_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

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.