Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Export SCCM Report to CSV

$
0
0

I am trying to create a Macro based Excel file that would contain a Macro, when executed would download a SCCM Report into a CSV file. At the moment I have to manually go to the webpage, wait for the report to be created and then click on a "Export to a file" button then choose a location and save. All is fine but I wanted to have some kind of automation. Since the webpage is created using SSRS reporting I cannot use standard HTML call out procedures like in these YouTube videos:

I have tried these VBA lines:

Sub Get_SCCM()
 
Dim IE As New InternetExplorer

IE.Visible = True

IE.navigate "www.google.co.uk"

Do
  DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE

Set TextBox = IE.document.getElementsByName("q")
TextBox.Item(0).Value = "OK"

End Sub

This Macro executes without any problems and you can see that the "OK" has been input into the Google searchbox. But When I tried this code:

Sub Get_SCCM()
 
Dim IE As New InternetExplorer

IE.Visible = True

IE.navigate "http://<Server_Name>/Reports/Pages/Report.aspx?ItemPath=%2f<Reports_Name>%2fInfrastructure%2f<Name>%2f<Report_File_Name>"

Do
  DoEvents
Loop Until IE.readyState = READYSTATE_COMPLETE

End Sub

I receive an error:

Run-time error '-2147417848 (80010108)'

Automation error

The object invoked has disconnected from its clients

Even does not work when trying to add extra lines like IE.document etc.

Any suggestions on how to export a CSV file with the report from SCCM webpage using VBA in Excel.

Thanks!


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>