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

Invoke hostinfo.php from powershell

Scheduled Pinned Locked Moved Solved
General
4
16
4.1k
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.
  • A
    andreas.paul
    last edited by Feb 28, 2017, 2:24 PM

    Hi togehter,

    i got a lot of informations here in the forum about the post installation scripts and so on.

    I need to run a powershell script after deployment. In this script i try to get the host informations from fog:

    Invoke-WebRequest http://${web}service/hostinfo.php?mac=$mac

    But all i get is:

    StatusCode : 200
    StatusDescription : OK
    Content : “Cannot view from browser”

    or without a user agent
    Invoke-WebRequest -UserAgent “”

    StatusCode : 200
    StatusDescription : OK
    Content : Invalid tasking!

    I researched the hostinfo.php and there is something with the User Agent but i don’t know exactly what?

    Is anybody able to help me out with this.

    Thanks so much for this good work,

    R,
    Andreas

    G 1 Reply Last reply Feb 28, 2017, 2:29 PM Reply Quote 0
    • T
      Tom Elliott
      last edited by Feb 28, 2017, 2:27 PM

      The first message you saw is 100% correct. You did the -UserAgent “” already and found the other part.

      This “hostinfo” is designed to only be used for hosts in a task, otherwise anybody could request information otherwise (especially considering it can contain information that could compromise your network).

      If you need to get data, the host needs to be in a “tasking”.

      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! Get in contact with me (chat bubble in the top right corner) if you want to join in.

      Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

      Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

      1 Reply Last reply Reply Quote 1
      • W
        Wayne Workman
        last edited by Feb 28, 2017, 2:29 PM

        You could also just query the fog database directly using the fogstorage credentials.

        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
        • G
          george1421 Moderator @andreas.paul
          last edited by Feb 28, 2017, 2:29 PM

          @andreas.paul said in Invoke hostinfo.php from powershell:

          Invoke-WebRequest http://${web}service/hostinfo.php?mac=$mac

          Just be aware that in your url you have embedded php variables which may really confuse powershell.

          Invoke-WebRequest http://${web}service/hostinfo.php?mac=$mac

          The ${web} variable represents the FOG server url of “<fog_server_ip>/fog”

          and $mac is the mac address of the target computer. You need to replace these with real literal strings.

          Such as
          Invoke-WebRequest http://192.168.1.22/fog/service/hostinfo.php?mac=00:08:12:34:56:78
          to make the url correct.

          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!

          1 Reply Last reply Reply Quote 0
          • A
            andreas.paul
            last edited by Feb 28, 2017, 2:45 PM

            Hi,

            thanks for the quick response.

            @Wayne-Workman
            Im intrested in the option to query the database direct, do you have any snipped for this?

            @Tom-Elliott
            It means if i “wrap” my script in a snapin i have access to the hostinfo because the host ist running a snapin task?

            R,

            Andreas

            T W 2 Replies Last reply Feb 28, 2017, 2:45 PM Reply Quote 0
            • T
              Tom Elliott @andreas.paul
              last edited by Feb 28, 2017, 2:45 PM

              @andreas.paul I’d have to look at the code, but theoretically yes.

              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! Get in contact with me (chat bubble in the top right corner) if you want to join in.

              Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

              Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

              T 1 Reply Last reply Feb 28, 2017, 2:52 PM Reply Quote 0
              • T
                Tom Elliott @Tom Elliott
                last edited by Feb 28, 2017, 2:52 PM

                Looked it over, and that seems correct.

                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! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                1 Reply Last reply Reply Quote 0
                • A
                  andreas.paul
                  last edited by Feb 28, 2017, 7:28 PM

                  Hi,

                  yes it works,

                  but not all fields ar filled with values:

                  [[ -z $primaryuser ]] && export primaryuser=‘’
                  [[ -z $othertag ]] && export othertag=‘’
                  [[ -z $othertag1 ]] && export othertag1=‘’

                  I have set a primaryuser but it is not shown.

                  By the way,
                  Do you plan to create a REST api ore something else?

                  R,

                  Andreas

                  G 2 Replies Last reply Feb 28, 2017, 7:35 PM Reply Quote 0
                  • G
                    george1421 Moderator @andreas.paul
                    last edited by Feb 28, 2017, 7:35 PM

                    @andreas.paul I can say for fog 1.x.x there are no plans for an REST api. With FOG 2.x (still a while off) there will be a lot more options since its reported that FOG 2.x may be using node.js for ist structure.

                    The intent of the hostinfo.php is to build a bash script that can be executed on the target computer for scripting, and not really how you are intending to use it. I’m not saying that you can’t work with it. You will just need to discard everything to the left of the space after the export tag.

                    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!

                    1 Reply Last reply Reply Quote 0
                    • G
                      george1421 Moderator @andreas.paul
                      last edited by george1421 Feb 28, 2017, 2:14 PM Feb 28, 2017, 8:14 PM

                      @andreas.paul Confirmed that primary user is not passed to hostinfo.php

                      [[ -z $imagepath ]] && export imagepath='WIN10_ENT_X64'
                      [[ -z $primaryuser ]] && export primaryuser=''
                      [[ -z $othertag ]] && export othertag='tag1'
                      [[ -z $othertag1 ]] && export othertag1='tag2'
                      [[ -z $sysman ]] && export sysman='VMware, Inc.'
                      

                      Primary user should list “JimBob” and not blank.
                      FOG version used 1.3.4

                      @Developers

                      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!

                      1 Reply Last reply Reply Quote 0
                      • T
                        Tom Elliott
                        last edited by Feb 28, 2017, 8:40 PM

                        Fixed for 1.3.5 working branch.

                        I’m working on issues with logical/extended partitions right now.

                        I can tell you all, I hate partitioning scheme maths.

                        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! Get in contact with me (chat bubble in the top right corner) if you want to join in.

                        Web GUI issue? Please check apache error (debian/ubuntu: /var/log/apache2/error.log, centos/fedora/rhel: /var/log/httpd/error_log) and php-fpm log (/var/log/php*-fpm.log)

                        Please support FOG if you like it: https://wiki.fogproject.org/wiki/index.php/Support_FOG

                        G 1 Reply Last reply Feb 28, 2017, 8:47 PM Reply Quote 0
                        • G
                          george1421 Moderator @Tom Elliott
                          last edited by Feb 28, 2017, 8:47 PM

                          @Tom-Elliott said in Invoke hostinfo.php from powershell:

                          Fixed for 1.3.5 working branch.
                          I can tell you all, I hate partitioning scheme maths.

                          Simple

                          p1 + p2 = (square root of infinity). That way it always fits.

                          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!

                          1 Reply Last reply Reply Quote 0
                          • A
                            andreas.paul
                            last edited by Mar 1, 2017, 6:27 AM

                            Hi,

                            thanks for fixing.

                            if i do a git pull witch version i will have, current is: “1.3.5-RC-10” is this the working branch?

                            Because if it is it will not work :-(.

                            0_1488349428109_upload-a9aa7b9e-b3e1-49e9-8483-6cc0b4522f88

                            And good look with your math study 🙂 I think i know what you try to to its the same shit as you try to mount the 5 extended partition in a dd file via loop, it’s crap.

                            R,

                            Andreas

                            G 2 Replies Last reply Mar 1, 2017, 10:33 AM Reply Quote 0
                            • G
                              george1421 Moderator @andreas.paul
                              last edited by Mar 1, 2017, 10:33 AM

                              @andreas.paul There is a development branch (i.e. pre RC11) where the fix lives. Let me check to see if the fix can be back ported to RC10.

                              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!

                              1 Reply Last reply Reply Quote 0
                              • G
                                george1421 Moderator @andreas.paul
                                last edited by Mar 1, 2017, 12:18 PM

                                @andreas.paul I sent you a DM (little talk bubble on the fog tool bar).

                                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!

                                1 Reply Last reply Reply Quote 0
                                • W
                                  Wayne Workman @andreas.paul
                                  last edited by Mar 1, 2017, 1:58 PM

                                  @andreas.paul said in Invoke hostinfo.php from powershell:

                                  Im intrested in the option to query the database direct, do you have any snipped for this?

                                  I’ve only done it with BASH, it’s easy in bash. Here’s an article about doing it in powershell. All I did was google-search “powershell query mysql” and there’s tons of results.
                                  http://www.thomasmaurer.ch/2011/04/powershell-run-mysql-querys-with-powershell/

                                  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
                                    16/16
                                    Last post

                                  156

                                  Online

                                  12.0k

                                  Users

                                  17.3k

                                  Topics

                                  155.2k

                                  Posts
                                  Copyright © 2012-2024 FOG Project