• Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login
  • Recent
  • Unsolved
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Register
  • Login

General Question - downloading inventory Automated

Scheduled Pinned Locked Moved Unsolved
Windows Problems
2
4
1.4k
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J
    jayrob86
    last edited by Mar 22, 2017, 6:48 PM

    This is more of a general question, but I am trying to see if anyone would know a way to download the inventory as CSV. I am trying to automate this and was thinking powershell

    $username = "user"
    $password = "pass"
     
    $ie = New-Object -com InternetExplorer.Application
    $ie.visible=$true
    $ie.navigate("url.lsps.org")
    while($ie.ReadyState -ne 4) {start-sleep -m 100}
    $ie.document.getElementById("username").value= "$username"
    $ie.document.getElementById("password").value = "$password"
    Start-Sleep -m 100
    $ie.document.getElementById("login-form-submit").click()
    Start-Sleep -s 4
    $ie.Navigate('http://fogserver.org/fog/management/?node=report&sub=inventory')
    Start-Sleep -s 4
    $ie.Navigate('http://fogserver.org/fog/management/export.php?type=csv')
    

    I can get this work in IE 11 but then I get a popup asking to save and I can’t figure out a way to stop this and my google-fu didn’t provide much luck. I can get all the elements and tags needed via this below snippet, but I am not sure how to input the data:

    $inv = Invoke-WebRequest 'fogserver.org' 
    $inv.ParsedHtml.getElementById("username")
    $inv.ParsedHtml.getElementById("password").value= "password"
    $inv.ParsedHtml.getElementById("login-form-submit").click()
    

    Any help is greatly appreciated.

    Thanks,

    1 Reply Last reply Reply Quote 0
    • W
      Wayne Workman
      last edited by Wayne Workman Mar 22, 2017, 6:18 PM Mar 23, 2017, 12:17 AM

      Probably easier to just query the DB directly using the fogstorage MySQL account. Putting together a CSV is pretty easy. I don’t know how to do it in powershell, but in BASH it’s easy to do. I can help with that, but I didn’t want to go script that until you responded saying that would work for you.

      Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
      Daily Clean Installation Results:
      https://fogtesting.fogproject.us/
      FOG Reporting:
      https://fog-external-reporting-results.fogproject.us/

      J 1 Reply Last reply Mar 23, 2017, 2:35 PM Reply Quote 1
      • J
        jayrob86 @Wayne Workman
        last edited by Mar 23, 2017, 2:35 PM

        @Wayne-Workman said in General Question - downloading inventory Automated:

        Probably easier to just query the DB directly using the fogstorage MySQL account. Putting together a CSV is pretty easy. I don’t know how to do it in powershell, but in BASH it’s easy to do. I can help with that, but I didn’t want to go script that until you responded saying that would work for you.

        @Wayne-Workman thanks for offering a better solution I actually think that this would work better. If you could provide a bit of insight how to query the database I think it would work best.
        Thanks for your assistance.
        If you can post the bash version I will work on the powershell version and share it as well.

        W 1 Reply Last reply Mar 24, 2017, 3:39 AM Reply Quote 2
        • W
          Wayne Workman @jayrob86
          last edited by Mar 24, 2017, 3:39 AM

          @jayrob86 See if this works. https://github.com/wayneworkman/fog-community-scripts/blob/master/exportFromDB/exportTableToCSV.sh

          Please help us build the FOG community with everyone involved. It's not just about coding - way more we need people to test things, update documentation and most importantly work on uniting the community of people enjoying and working on FOG!
          Daily Clean Installation Results:
          https://fogtesting.fogproject.us/
          FOG Reporting:
          https://fog-external-reporting-results.fogproject.us/

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          1 / 1
          • First post
            1/4
            Last post

          150

          Online

          12.1k

          Users

          17.3k

          Topics

          155.4k

          Posts
          Copyright © 2012-2024 FOG Project